How to fix npm WARN bin npm WARN bin Command conflicts: package-a and package-b both use the same bin name in npm

npmINTERMEDIATELOWUpdated Dec 3, 2025· 166 views

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.

Quick fix

Fixes npm WARN bin npm WARN bin Command conflicts: package-a and package-b both use the same bin name

# 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 script
  1. Identify the conflicting packages
  2. Use direct path to specific package
  3. Use npx with package specifier
  4. Remove unnecessary package
npm — error
# 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 script
npm WARN bin npm WARN bin Command conflicts: package-a and package-b both use the same bin name

What this error means

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.

Typical symptoms

  • npm WARN about command conflicts during install
  • Running binary executes wrong package
  • Build works on one machine but fails on another
  • Different behavior between npm install and npm ci

Common causes

  1. Two packages use identical binary names
  2. Transitive dependency has same binary as direct dependency
  3. Generic binary names (app, cli, build)
  4. Forked packages keeping original binary names

How to fix "npm WARN bin npm WARN bin Command conflicts: package-a and package-b both use the same bin name"

1Identify the conflicting packages

Check which packages are conflicting:

bash
# 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 script
2Use direct path to specific package

Reference the exact package you want:

json
{
  "scripts": {
    "compile": "node ./node_modules/typescript/bin/tsc",
    "check": "node ./node_modules/@tsd/typescript/bin/tsc"
  }
}
3Use npx with package specifier

npx can target specific packages:

bash
# Run typescript's tsc
npx -p typescript tsc --version

# Run @tsd/typescript's tsc
npx -p @tsd/typescript tsc --version

In package.json:

json
{
  "scripts": {
    "build": "npx -p typescript tsc"
  }
}
4Remove unnecessary package

If one package is unnecessary, remove it:

bash
# Check why package is installed
npm ls @tsd/typescript

# If direct dependency, uninstall
npm uninstall @tsd/typescript

If it's a transitive dependency, check if the parent package can be updated.

5Use npm ci for reproducible builds

Ensure consistent install order:

bash
# In CI/CD, use npm ci
npm ci

Verify which binary won:

bash
cat node_modules/.bin/[binary-name]

Advanced notes

For package maintainers, avoid generic binary names:

Bad:

json
{ "bin": { "cli": "./bin/cli.js" } }

Good:

json
{ "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.

Frequently asked questions

What does "npm WARN bin npm WARN bin Command conflicts: package-a and package-b b" mean?
bin/. json "bin" field, they conflict. npm installs both but only one symlink can exist—the last installed package overwrites the first.
How do I fix "npm WARN bin npm WARN bin Command conflicts: package-a and package-b b"?
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.
What causes "npm WARN bin npm WARN bin Command conflicts: package-a and package-b b"?
Two packages use identical binary names Transitive dependency has same binary as direct dependency Generic binary names (app, cli, build)
Is the "npm WARN bin npm WARN bin Command conflicts: package-a and package-b b" error serious?
It is a low-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading