From 3a5a8a9df9b24044faab879a59082c90f28cf667 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Tue, 9 Jun 2026 10:12:56 -0700 Subject: [PATCH] docs: approve-scripts only throws EGLOBAL when run with -g (cherry picked from commit 357e8cdcb8f44326a50cee2539219a91d8bfbbe5) --- docs/lib/content/commands/npm-approve-scripts.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/lib/content/commands/npm-approve-scripts.md b/docs/lib/content/commands/npm-approve-scripts.md index 8961b836a75a7..ce39e65082c17 100644 --- a/docs/lib/content/commands/npm-approve-scripts.md +++ b/docs/lib/content/commands/npm-approve-scripts.md @@ -19,10 +19,10 @@ In 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. -This command only works inside a project that has a `package.json`. It does -not apply to global installs (`npm install -g`) or one-off executions -(`npm exec` / `npx`), which have no project `package.json` to write to and -will fail with an `EGLOBAL` error. To allow install scripts in those +This command only works inside a project that has a `package.json`. Running +it with `--global` (`-g`) fails with an `EGLOBAL` error, since global +installs (`npm install -g`) and one-off executions (`npm exec` / `npx`) have +no project `package.json` to write to. To allow install scripts in those contexts, use the `--allow-scripts` flag at install time (for example `npm install -g --allow-scripts=canvas,sharp`) or persist the setting with `npm config set allow-scripts=canvas,sharp --location=user`.