npm defaults to putting stuff in slightly silly places (see npm-folders).
To save more reasonable paths in ~/.npmrc
:
npm config set prefix ~/.local
npm config set cache ~/.cache/npm
This makes npm install -g
user-local, and keeps its cache in the default XDG cache directory.