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 ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error