This warning appears when two packages try to install executables with the same name in node_modules/.bin. The last installed package wins, potentially causing unexpected behavior.
When npm installs packages, it creates executable symlinks in node_modules/.bin/. If two packages declare the same binary name in their package.json "bin" field, they conflict. npm installs both but only one symlink can exist—the last installed package overwrites the first. This is a design limitation in npm. The warning alerts you that running the binary might execute a different package than expected. Common with packages like TypeScript (@tsd/typescript vs typescript both providing "tsc"). Install order determines which binary "wins," making builds potentially non-deterministic.
Check which packages are conflicting:
# List .bin contents
ls -la node_modules/.bin/
# See which package a binary points to
cat node_modules/.bin/tsc
# Look for the path in the scriptReference the exact package you want:
{
"scripts": {
"compile": "node ./node_modules/typescript/bin/tsc",
"check": "node ./node_modules/@tsd/typescript/bin/tsc"
}
}npx can target specific packages:
# Run typescript's tsc
npx -p typescript tsc --version
# Run @tsd/typescript's tsc
npx -p @tsd/typescript tsc --versionIn package.json:
{
"scripts": {
"build": "npx -p typescript tsc"
}
}If one package is unnecessary, remove it:
# Check why package is installed
npm ls @tsd/typescript
# If direct dependency, uninstall
npm uninstall @tsd/typescriptIf it's a transitive dependency, check if the parent package can be updated.
Ensure consistent install order:
# In CI/CD, use npm ci
npm ciVerify which binary won:
cat node_modules/.bin/[binary-name]For package maintainers, avoid generic binary names:
Bad:
{ "bin": { "cli": "./bin/cli.js" } }Good:
{ "bin": { "mypackage-cli": "./bin/cli.js" } }npm doesn't provide built-in resolution—the last installed package wins. This is a known limitation dating back to npm v3. Using direct paths or npx with package specifiers is the most reliable workaround.
npm error code ENOENT npm error syscall spawn git npm error path git npm error errno -4058 npm error enoent An unknown git error occurred
How to fix "spawn git ENOENT" in npm
npm error code E401 npm error Incorrect or missing password.
How to fix 'E401 Unable to authenticate' errors with npm private registries
npm notice access token expired or revoked. Please try logging in again.
Token has expired - npm authentication failure
npm ERR! code EAI_AGAIN
How to fix "EAI_AGAIN" in npm
npm error code E403 npm error 403 Forbidden - PUT https://registry.npmjs.org/<package>
How to fix 'E403 Forbidden' error in npm