File Explorer

/var/lang/lib/node_modules/npm/man/man1

This explorer reads the filesystem of the server it runs on, so /workspace/user isn't present here. Browsing and the terminal still work against this server's own disk from /.

npm-approve-scripts.14.4 KB · 116 lines
.TH "NPM-APPROVE-SCRIPTS" "1" "June 2026" "NPM@11.17.0" "".SH "NAME"\fBnpm-approve-scripts\fR - Approve install scripts for specific dependencies.SS "Synopsis".P.RS 2.nfnpm approve-scripts <pkg> \[lB]<pkg> ...\[rB]npm approve-scripts --allnpm approve-scripts --allow-scripts-pending.fi.RE.PNote: This command is unaware of workspaces..SS "Description".PManages the \fBallowScripts\fR field in your project's \fBpackage.json\fR, which records which of your dependencies are permitted to run install scripts (\fBpreinstall\fR, \fBinstall\fR, \fBpostinstall\fR, and \fBprepare\fR for non-registry sources). This command is the recommended way to maintain that field..PIn the current release, this field is advisory: install scripts still run by default, but installs print a list of packages whose scripts have not been reviewed. A future release will block unreviewed install scripts..PThis command only works inside a project that has a \fBpackage.json\fR. Running it with \fB--global\fR (\fB-g\fR) fails with an \fBEGLOBAL\fR error, since global installs (\fBnpm install -g\fR) and one-off executions (\fBnpm exec\fR / \fBnpx\fR) have no project \fBpackage.json\fR to write to. To allow install scripts in those contexts, use the \fB--allow-scripts\fR flag at install time (for example \fBnpm install -g --allow-scripts=canvas,sharp\fR) or persist the setting with \fBnpm config set allow-scripts=canvas,sharp --location=user\fR..PThere are three modes:.P.RS 2.nfnpm approve-scripts <pkg> \[lB]<pkg> ...\[rB]npm approve-scripts --allnpm approve-scripts --allow-scripts-pending.fi.RE.P\fB<pkg>\fR matches every installed version of that package. By default the command writes pinned entries (\fBpkg@1.2.3\fR), which keep their approval narrowed to the specific version you reviewed. Pass \fB--no-allow-scripts-pin\fR to write name-only entries that allow any future version..P\fB--all\fR approves every package with unreviewed install scripts in one go..P\fB--allow-scripts-pending\fR is read-only: it lists every package whose install scripts are not yet covered by \fBallowScripts\fR, without modifying \fBpackage.json\fR..P\fBapprove-scripts\fR honours the asymmetric pin rule: if you re-approve a package whose installed version has changed, the existing pin is rewritten to track the new installed version. Multi-version statements (\fBpkg@1 || 2\fR) are left alone, since they likely capture intent that the command cannot infer. Existing \fBfalse\fR entries always win; \fBapprove-scripts\fR will not silently re-allow a package you previously denied..SS "Examples".P.RS 2.nf# Approve all currently-installed install scripts after reviewing themnpm approve-scripts --all # Approve specific packages, pinned to their installed versionnpm approve-scripts canvas sharp # Approve name-only (any version of this package is allowed)npm approve-scripts --no-allow-scripts-pin canvas # Preview which packages still need reviewnpm approve-scripts --allow-scripts-pending.fi.RE.SS "Configuration".SS "\fBall\fR".RS 0.IP \(bu 4Default: false.IP \(bu 4Type: Boolean.RE 0 .PShow or act on all packages, not just the ones your project directly depends on. For \fBnpm outdated\fR and \fBnpm ls\fR this lists every outdated or installed package. For \fBnpm approve-scripts\fR and \fBnpm deny-scripts\fR it selects every package with pending install scripts..SS "\fBallow-scripts-pending\fR".RS 0.IP \(bu 4Default: false.IP \(bu 4Type: Boolean.RE 0 .PList packages with install scripts that are not yet covered by the \fBallowScripts\fR policy, without modifying \fBpackage.json\fR. Only meaningful for \fBnpm approve-scripts\fR..SS "\fBallow-scripts-pin\fR".RS 0.IP \(bu 4Default: true.IP \(bu 4Type: Boolean.RE 0 .PWrite pinned (\fBpkg@version\fR) entries when approving install scripts. Set to \fBfalse\fR to write name-only entries that allow any version. Has no effect on \fBnpm deny-scripts\fR, which always writes name-only entries regardless of this setting..SS "\fBjson\fR".RS 0.IP \(bu 4Default: false.IP \(bu 4Type: Boolean.RE 0 .PWhether or not to output JSON data, rather than the normal output..RS 0.IP \(bu 4In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR..RE 0 .PNot supported by all npm commands..SS "See Also".RS 0.IP \(bu 4npm help deny-scripts.IP \(bu 4npm help install.IP \(bu 4npm help rebuild.IP \(bu 4\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR.RE 0