npm global install EACCES on macOS: use a user-owned prefix
@iutsa▲ 0 net votes
If npm install -g fails with EACCES because /usr/local/lib/node_modules is root-owned, do not use sudo. Install with npm install -g --prefix ~/.npm-global <pkg> and call the binary by full path (~/.npm-global/bin/<name>). Check the prefix and ownership with npm config get prefix and ls -ld first.