patch-1
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-deny-scripts |
| 3 | section: 1 |
| 4 | description: Deny install scripts for specific dependencies |
| 5 | github_repo: npm/cli |
| 6 | github_branch: latest |
| 7 | github_path: docs/lib/content/commands/npm-deny-scripts.md |
| 8 | redirect_from: |
| 9 | - /cli-commands/deny-scripts |
| 10 | - /cli-commands/npm-deny-scripts |
| 11 | - /cli-documentation/cli-commands/deny-scripts |
| 12 | - /cli-documentation/cli-commands/npm-deny-scripts |
| 13 | - /cli-documentation/commands/deny-scripts |
| 14 | - /cli-documentation/commands/npm-deny-scripts |
| 15 | - /cli-documentation/deny-scripts |
| 16 | - /cli-documentation/npm-deny-scripts |
| 17 | - /cli-documentation/v11/cli-commands/deny-scripts |
| 18 | - /cli-documentation/v11/cli-commands/npm-deny-scripts |
| 19 | - /cli-documentation/v11/commands/deny-scripts |
| 20 | - /cli-documentation/v11/commands/npm-deny-scripts |
| 21 | - /cli-documentation/v11/deny-scripts |
| 22 | - /cli-documentation/v11/npm-deny-scripts |
| 23 | - /cli/cli-commands/deny-scripts |
| 24 | - /cli/cli-commands/npm-deny-scripts |
| 25 | - /cli/commands/deny-scripts |
| 26 | - /cli/commands/npm-deny-scripts |
| 27 | - /cli/deny-scripts |
| 28 | - /cli/npm-deny-scripts |
| 29 | - /cli/v11/cli-commands/deny-scripts |
| 30 | - /cli/v11/cli-commands/npm-deny-scripts |
| 31 | - /cli/v11/commands/deny-scripts |
| 32 | - /cli/v11/deny-scripts |
| 33 | - /cli/v11/npm-deny-scripts |
| 34 | - /commands/deny-scripts |
| 35 | - /commands/npm-deny-scripts |
| 36 | --- |
| 37 | |
| 38 | ### Synopsis |
| 39 | |
| 40 | ```bash |
| 41 | npm deny-scripts <pkg> [<pkg> ...] |
| 42 | npm deny-scripts --all |
| 43 | ``` |
| 44 | |
| 45 | Note: This command is unaware of workspaces. |
| 46 | |
| 47 | ### Description |
| 48 | |
| 49 | The companion command to [`npm approve-scripts`](/cli/v11/commands/npm-approve-scripts). Writes `false` entries into the `allowScripts` field of your project's `package.json`, recording that a dependency must not run install scripts even if a future version would otherwise be eligible. |
| 50 | |
| 51 | In the current release, install scripts still run by default, so `deny-scripts` only affects how installs of denied packages are reported. A future release will block unreviewed install scripts and respect deny entries at install time. |
| 52 | |
| 53 | ```bash |
| 54 | npm deny-scripts <pkg> [<pkg> ...] |
| 55 | npm deny-scripts --all |
| 56 | ``` |
| 57 | |
| 58 | `<pkg>` matches every installed version of that package. Denies are always written name-only (`"pkg": false`), regardless of `--allow-scripts-pin`. Pinning a deny to a specific version would silently re-allow scripts for any other version of the same package, which defeats the purpose; the command picks the safer default for you. |
| 59 | |
| 60 | `--all` denies every package with unreviewed install scripts. |
| 61 | |
| 62 | If a `true` (pinned or name-only) entry exists for a package and you then deny it, the existing allow entries are removed so the name-only deny is unambiguous. |
| 63 | |
| 64 | ### Examples |
| 65 | |
| 66 | ```bash |
| 67 | # Deny a specific package outright |
| 68 | npm deny-scripts telemetry-pkg |
| 69 | |
| 70 | # Deny everything that has install scripts and isn't already approved |
| 71 | npm deny-scripts --all |
| 72 | ``` |
| 73 | |
| 74 | ### Configuration |
| 75 | |
| 76 | #### `all` |
| 77 | |
| 78 | - Default: false |
| 79 | - Type: Boolean |
| 80 | |
| 81 | When running `npm outdated` and `npm ls`, setting `--all` will show all outdated or installed packages, rather than only those directly depended upon by the current project. |
| 82 | |
| 83 | #### `allow-scripts-pending` |
| 84 | |
| 85 | - Default: false |
| 86 | - Type: Boolean |
| 87 | |
| 88 | List packages with install scripts that are not yet covered by the `allowScripts` policy, without modifying `package.json`. Only meaningful for `npm approve-scripts`. |
| 89 | |
| 90 | #### `allow-scripts-pin` |
| 91 | |
| 92 | - Default: true |
| 93 | - Type: Boolean |
| 94 | |
| 95 | Write pinned (`pkg@version`) entries when approving install scripts. Set to `false` to write name-only entries that allow any version. Has no effect on `npm deny-scripts`, which always writes name-only entries regardless of this setting. |
| 96 | |
| 97 | #### `json` |
| 98 | |
| 99 | - Default: false |
| 100 | - Type: Boolean |
| 101 | |
| 102 | Whether or not to output JSON data, rather than the normal output. |
| 103 | |
| 104 | - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`. |
| 105 | |
| 106 | Not supported by all npm commands. |
| 107 | |
| 108 | ### See Also |
| 109 | |
| 110 | - [npm approve-scripts](/cli/v11/commands/npm-approve-scripts) |
| 111 | - [npm install](/cli/v11/commands/npm-install) |
| 112 | - [package.json](/cli/v11/configuring-npm/package-json) |