Install NPM packages in home directory

Create the ~/.npmrc file with the following content:

prefix = "~/.local"

Add the following line to your .bash_profile:

export PATH=~/.local/bin:$PATH

Now you can install a npm package without your root password:

npm install -g eslint

which eslint
# /home/me/.local/bin/eslint