Binary-related npm errors occur when package executables aren't properly installed or linked. Clear node_modules, reinstall dependencies, and ensure your npm version is compatible with your lockfile.
This error indicates that npm couldn't find or create the executable binary for a package. When you install packages with CLI tools (like typescript, eslint, or vite), npm creates symlinks in node_modules/.bin that point to the package's executable files. If this process fails, the binaries won't be available. The issue typically manifests when trying to run a tool that should have been installed—for example, running `npx tsc` after installing TypeScript but getting a "not found" error. The package exists in node_modules, but the executable link is missing. This can happen due to npm version incompatibilities, corrupted installations, filesystem issues (especially on Windows or in Docker), or race conditions during parallel installations.
The most reliable fix is a clean reinstall:
rm -rf node_modules package-lock.json
npm installThis removes any corrupted state and regenerates the lockfile with proper binary links.
Cached packages might be corrupted:
npm cache clean --force
npm cache verify
npm installThe verify command checks cache integrity and removes corrupted entries.
Verify what binaries exist:
ls -la node_modules/.bin/If it's empty or missing expected tools, the installation didn't complete properly. If the directory doesn't exist at all, npm failed to create it.
For CI environments and reproducible builds:
npm ciThis command removes node_modules, installs exactly what's in package-lock.json, and is more reliable for creating binary links.
On Windows, Vagrant, or shared folders where symlinks fail:
npm install --no-bin-linksThis creates copies instead of symlinks. Note that some tools may not work correctly without proper symlinks.
Older versions have known binary installation bugs:
# Check versions
node --version
npm --version
# Update npm
npm install -g npm@latestUse nvm to manage Node.js versions and ensure consistency across environments.
On Windows, npm historically had issues with symlinks due to permission requirements. Windows 10+ supports symlinks better, but you may need to enable Developer Mode or run your terminal as Administrator.
In Docker, if you mount node_modules as a volume, the .bin directory from your host might not be compatible with the container's architecture. Use named volumes or rebuild node_modules inside the container:
COPY package*.json ./
RUN npm ci
COPY . .For Vagrant users, the --no-bin-links flag is often necessary when the node_modules directory is on a shared folder. Alternatively, place node_modules outside the shared folder using npm's prefix configuration.
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
npm ERR! code EUSAGE npm ERR! Usage error
How to fix "npm ERR! code EUSAGE" in Node.js projects
npm ERR! code E401 npm ERR! 401 Unauthorized
How to fix "E401 Unauthorized" in npm