Install global NPM packages locally
Here's a quick how-to on installing NPM global packages locally without sudo.
There are a few different ways of achieving the same end result, but I found this way the most simple.
First, run below command to configure NPM to use the ~/.local/ directory. This will modify ~/.npmrc to include prefix=~/.local/.
If your $PATH does not already include ~/.local/bin you must add it. Replace .zshrc with what ever shell you would use other than zsh.
That is it. Now, when ever you install a global package, it will be installed to ~/.local/bin and you will be able to run it.