1. Create a directory where global packages will be deployed:
2. Set the newly created directory as default global directory for npm:
npm config set prefix '~/.npm-global'
3. Update the $PATH environment variable by adding this to your .profile file (in your user home directory) so that the terminal knows where to find the global packages:
4. Reload environment in current shell by running (or just open a new one):
5. Test if the setup was successful by installing a package (without using
npm i -g jshint
6. And running it (should print out jshint version):