Part of #9608.
Is there an existing issue for this?
This issue exists in the latest npm version
This is not just a request to bump a dependency for a CVE
Current Behavior
A workspace depends on another workspace that provides a bin. The bin shim is correctly created in the consumer workspace's node_modules/.bin/, but npm exec -w <ws> -- <bin> under install-strategy=linked ignores it and falls through to the registry, producing npm error code E404 (exit 1). The hoisted strategy runs the local bin.
Expected Behavior
npm exec -w <ws> -- <bin> should run the workspace-local bin under the linked strategy, as it does under hoisted, without contacting the registry.
Steps To Reproduce
cd "$(mktemp -d)"
echo 'install-strategy=linked' > .npmrc
echo '{ "name": "root", "version": "1.0.0", "workspaces": ["packages/*"] }' > package.json
mkdir -p packages/a packages/tool
echo '{ "name": "a", "version": "1.0.0", "dependencies": { "tool": "*" } }' > packages/a/package.json
echo '{ "name": "tool", "version": "1.0.0", "bin": { "zz-bin": "cli.js" } }' > packages/tool/package.json
printf '#!/usr/bin/env node\nconsole.log("tool bin ok")\n' > packages/tool/cli.js
chmod +x packages/tool/cli.js
npm install >/dev/null
readlink packages/a/node_modules/.bin/zz-bin # ../tool/cli.js (bin from dep workspace, present)
npm exec -w a -- zz-bin
# linked: npm error code E404 GET https://registry.npmjs.org/zz-bin (exit 1)
# hoisted: prints "tool bin ok" (exit 0)
Environment
- npm: 12.0.0-pre.1 (
latest)
- Node.js: v24.17.0
- OS Name: macOS (Darwin 25.5.0)
- System Model Name: MacBook (arm64)
- npm config:
Part of #9608.
Is there an existing issue for this?
This issue exists in the latest npm version
This is not just a request to bump a dependency for a CVE
Current Behavior
A workspace depends on another workspace that provides a bin. The bin shim is correctly created in the consumer workspace's
node_modules/.bin/, butnpm exec -w <ws> -- <bin>underinstall-strategy=linkedignores it and falls through to the registry, producingnpm error code E404(exit 1). The hoisted strategy runs the local bin.Expected Behavior
npm exec -w <ws> -- <bin>should run the workspace-local bin under the linked strategy, as it does under hoisted, without contacting the registry.Steps To Reproduce
Environment
latest)install-strategy=linked