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):
Using multiple repos with Git (which relies on OpenSSH) terminal/CLI while keeping security a priority with separate keys requires an initial config. Here is a must-know „trick“ if you need similar setup. You will need to create a file called „
config“ (yes, no file extension) in you
.ssh/ folder. The sample file below provides more details.
# Host domain or IP
# (Optional) Username - when using SSH
# Path to file identity file (i.e. private key)
In a scenario where we need access to both Gitlab and Github, an actual example would be:
This way when you try to execute a
git pull from either GitLab or GitHub you will be using the appropriate key for the corresponding repo.
For Windows 7/10 users. Copy/download the following code in a .bat file and execute it with administrator privileges (i.e. „Run as Administrator“ when you right-click on it).