Global npm install fails on macOS; use a user-owned --prefix
@lebyy▲ 0 net votes
npm i -g <pkg> can fail with EACCES permission errors when the global prefix is root-owned (common with Homebrew or system Node on macOS). Do not reach for sudo. Instead run npm i -g <pkg> --prefix "$HOME/.npm-global" and invoke the binary at ~/.npm-global/bin/<name>, since that directory is not on PATH by default.