[BUG] denying a package's install scripts via `allowScripts` also drops its `.bin` links · Issue #9681 · npm/cli · GitHub
Skip to content

[BUG] denying a package's install scripts via allowScripts also drops its .bin links #9681

Closed

Description

@manzoorwanijk

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

This is not just a request to bump a dependency for a CVE

  • This is not solely a request to bump a dependency for a CVE

Present on the released npm 11.x (reproduced on 11.17.0). Already fixed on latest (npm 12) by PR #9424, which rewrote the gate as a side effect. So npm 11 still has the bug.

Current Behavior

A package denied in allowScripts ("<pkg>": false) is installed without its node_modules/.bin/<bin> symlinks. The package directory is present and its binary is runnable, but nothing links it onto PATH, so any build step that shells out to the bin fails with command not found (observed with esbuild, nx). Only denied packages that declare a bin are affected.

This is inconsistent with --ignore-scripts, which skips install scripts but still links bins. A per-package allowScripts: false should behave the same — skip the scripts, keep the bins — but it strands the bin links.

Expected Behavior

Denying a package's install scripts must not affect its bin linking. allowScripts: { "<pkg>": false } should skip that package's lifecycle scripts while still creating its node_modules/.bin/<bin> symlinks, matching --ignore-scripts semantics.

Steps To Reproduce

esbuild declares both an install script and a bin, so a name-only deny matches it (registry node) and exposes the drop.

mkdir esb && cd esb
cat > package.json <<'JSON'
{
  "name": "esb",
  "version": "1.0.0",
  "dependencies": { "esbuild": "0.25.0" },
  "allowScripts": { "esbuild": false }
}
JSON
npm install --no-audit --no-fund
ls node_modules/.bin/esbuild        # ENOENT on npm 11
node_modules/.bin/esbuild --version # sh: esbuild: command not found

Observed (npm 11.17.0): esbuild is installed under node_modules/esbuild, but node_modules/.bin/ is empty — no esbuild shim. Removing the allowScripts deny restores the bin link, confirming the deny is what drops it.

On latest (npm 12) the same install links .bin/esbuild correctly.

Environment

  • npm: 11.17.0 (release/v11); fixed on latest (12.0.0-pre.1)
  • Node.js: v24.17.0
  • OS Name: macOS (Darwin 25.5.0)
  • System Model Name: Mac17,6

Activity

  1. manzoorwanijk commented on Jun 27, 2026

    @manzoorwanijk
    ContributorAuthor
  2. added a commit that references this issue on Jun 29, 2026
    774875b
  3. manzoorwanijk commented on Jun 29, 2026

    @manzoorwanijk
    ContributorAuthor

    Fixed via #9686

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions