Global npm symlinks fail because the bin path is not writable or symlinks are restricted. Use nvm/user prefixes, fix ownership, or adjust Windows symlink policy.
npm creates symlinks in the global bin directory (prefix/bin) for installed binaries. If that directory is root-owned (Linux/macOS) or symlink creation is restricted (Windows without Developer Mode/admin), npm cannot create the link and aborts with EACCES. In CI/Docker, running as non-root with a root-owned prefix causes the same failure.
npm config get prefix
ls -ld $(npm config get prefix)/binIf root-owned, user installs cannot create symlinks there.
# nvm example
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \ . "$NVM_DIR/nvm.sh"
nvm install --lts
# user prefix fallback
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
export PATH="$HOME/.npm-global/bin:$PATH"sudo chown -R $(whoami) /usr/local/{lib/node_modules,bin,share}Do this only on machines you manage (not shared/CI images).
Enable Developer Mode (Settings → For Developers) or run an elevated PowerShell/CMD for the install. Avoid installing to protected drives; prefer user-scoped Node (nvm-windows) under your profile.
npm cache clean --force
npm install -g npmIn Docker/CI, run npm as the user that owns the image filesystem or set prefix to a writable path. On macOS Homebrew installs, ensure /usr/local/bin is writable by the Homebrew user or switch to nvm to keep globals in $HOME. User prefixes avoid root-owned symlink targets entirely.
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