PageSourceSearch

https://pnpm.io/assets/js/78f08245.64d4e6d2.js

js pnpm.io collected 2026-09-24 07:23:06 UTC 6,084 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["17676"],{38230(e,n,i){i.r(n),i.d(n,{metadata:()=>a,default:()=>c,frontMatter:()=>s,contentTitle:()=>o,toc:()=>r,assets:()=>d});var a=JSON.parse('{"id":"cli/approve-builds","title":"pnpm approve-builds","description":"Added in: v10.1.0","source":"@site/versioned_docs/version-11.x/cli/approve-builds.md","sourceDirName":"cli","slug":"/cli/approve-builds","permalink":"/11.x/cli/approve-builds","draft":false,"unlisted":false,"editUrl":"https://github.com/pnpm/pnpm.io/edit/main/versioned_docs/version-11.x/cli/approve-builds.md","tags":[],"version":"11.x","lastUpdatedBy":"Zoltan Kochan","lastUpdatedAt":1789071248000,"frontMatter":{"id":"approve-builds","title":"pnpm approve-builds"},"sidebar":"docs","previous":{"title":"pnpm start","permalink":"/11.x/cli/start"},"next":{"title":"pnpm ignored-builds","permalink":"/11.x/cli/ignored-builds"}}'),l=i(91987),t=i(67008);let s={id:"approve-builds",title:"pnpm approve-builds"},o,d={},r=[{value:"Usage",id:"usage",level:2},{value:"Options",id:"options",level:2},{value:"--all",id:"--all",level:3},{value:"--global, -g",id:"--global--g",level:3}];function p(e){let n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,t.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.p,{children:"Added in: v10.1.0"}),"\n",(0,l.jsx)(n.p,{children:"Approve dependencies for running scripts during installation."}),"\n",(0,l.jsxs)(n.p,{children:["The approved dependencies are added to the ",(0,l.jsx)(n.a,{href:"/11.x/settings/build#allowbuilds",children:(0,l.jsx)(n.code,{children:"allowBuilds"})})," map in ",(0,l.jsx)(n.code,{children:"pnpm-workspace.yaml"})," with a value of ",(0,l.jsx)(n.code,{children:"true"}),", while unapproved ones are saved with a value of ",(0,l.jsx)(n.code,{children:"false"}),". You can also update these settings manually if you prefer."]}),"\n",(0,l.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,l.jsxs)(n.p,{children:["You can run ",(0,l.jsx)(n.code,{children:"pnpm approve-builds"})," without arguments to get an interactive prompt, or pass package names as positional arguments:"]}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-sh",children:"pnpm approve-builds esbuild fsevents !core-js\n"})}),"\n",(0,l.jsxs)(n.p,{children:["Prefix a package name with ",(0,l.jsx)(n.code,{children:"!"})," to deny it. Only mentioned packages are affected; the rest are left untouched."]}),"\n",(0,l.jsx)(n.p,{children:"Since v11.26.0, a decision is saved even when nothing is awaiting approval, so a policy can be written before the package is installed. A named package that is not awaiting approval is reported with a warning rather than an error, and is not rebuilt: it may not be installed yet, and rebuilding it would need a lockfile the project may not have. An argument that names no package at all is rejected before anything is written."}),"\n",(0,l.jsxs)(n.p,{children:["During install, packages with ignored builds that are not yet listed in ",(0,l.jsx)(n.code,{children:"allowBuilds"})," are automatically added to ",(0,l.jsx)(n.code,{children:"pnpm-workspace.yaml"})," with a placeholder value, so you can manually set them to ",(0,l.jsx)(n.code,{children:"true"})," or ",(0,l.jsx)(n.code,{children:"false"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["Since v11.23.0, writing ",(0,l.jsx)(n.code,{children:"allowBuilds"})," also removes ",(0,l.jsx)(n.code,{children:"onlyBuiltDependencies"}),", ",(0,l.jsx)(n.code,{children:"onlyBuiltDependenciesFile"}),", ",(0,l.jsx)(n.code,{children:"neverBuiltDependencies"}),", and ",(0,l.jsx)(n.code,{children:"ignoredBuiltDependencies"})," from ",(0,l.jsx)(n.code,{children:"pnpm-workspace.yaml"}),". ",(0,l.jsx)(n.code,{children:"allowBuilds"})," replaced those settings in pnpm 11 and they have been ignored since, so a workspace migrated from pnpm 10 kept them around looking active."]}),"\n",(0,l.jsx)(n.h2,{id:"options",children:"Options"}),"\n",(0,l.jsx)(n.h3,{id:"--all",children:"--all"}),"\n",(0,l.jsx)(n.p,{children:"Added in: v10.32.0"}),"\n",(0,l.jsx)(n.p,{children:"Approve all pending builds without interactive prompts."}),"\n",(0,l.jsx)(n.h3,{id:"--global--g",children:"--global, -g"}),"\n",(0,l.jsxs)(n.p,{children:["Approve builds for ",(0,l.jsx)(n.a,{href:"/11.x/global-packages",children:"globally installed packages"}),"."]}),"\n",(0,l.jsxs)(n.p,{children:["pnpm gathers the packages awaiting approval across ",(0,l.jsx)(n.strong,{children:"every"})," ",(0,l.jsx)(n.a,{href:"/11.x/global-packages#isolated-installations",children:"isolated install\ngroup"}),", asks about them once, and\nwrites a single policy into the ",(0,l.jsx)(n.code,{children:"pnpm-workspace.yaml"})," of the global packages\ndirectory. Only the groups that actually contain an approved package are then\nrebuilt."]}),"\n",(0,l.jsx)(n.admonition,{title:"Removed in v11.0.0, back in v11.24.0",type:"info",children:(0,l.jsxs)(n.p,{children:["Isolated global installs gave every install group its own manifest, and\n",(0,l.jsx)(n.code,{children:"pnpm approve-builds -g"})," was removed rather than made to guess which one to\nwrite to. Since v11.24.0 it writes one policy for all of them, so it works\nagain. In between \u2014 and still, if you would rather decide at install time \u2014 use\n",(0,l.jsx)(n.code,{children:"--allow-build"})," when installing globally (e.g.\n",(0,l.jsx)(n.code,{children:"pnpm add -g --allow-build=esbuild esbuild"}),"), or answer the prompt pnpm shows\nduring a global install."]})})]})}function c(e={}){let{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(p,{...e})}):p(e)}},67008(e,n,i){i.d(n,{R:()=>s,x:()=>o});var a=i(71763);let l={},t=a.createContext(l);function s(e){let n=a.useContext(t);return a.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:s(e.components),a.createElement(t.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.