document.write("
Download & Install LTS NodeJS Package from here
Create new Directory for NPM and Global Packages:
\nmkdir ~/.npm-packages
Configure NPM to use the new directory:
\nnpm config set prefix ~/.npm-packages/
Create or Modify ~/.bash_profile
or ~/.zshrc
and add the following:
NOTE: Starting with macOS Catalina, ZSH will be the default shell
\nNOTE: I use Visual Studio Code and have enabled Launching from the command line.
\ncode ~/.bash_profile
or code ~/.zshrc
Add the following line to ~/.bash_profile
or ~/.zshrc
# The next line is for running NPM \nexport PATH=~/.npm-packages/bin:$PATH\n
Run the below command to update system variables:
\nsource ~/.bash_profile
or source ~/.zshrc
NOTE: I highy recommend you completely exit and restart Terminal/SecureCRT instead of running this command to ensure configuration sticks.
Verify NPM is running in your new location:
\nnpm list -g -depth=0
\n\nOutput should look similar to below (emphasis added):
\n
JMCOMBSMBP:~ jmcombs$ npm list -g -depth=0\n\\!h /Users/jmcombs/.npm-packages/lib\n└── npm@6.9.0\n
Upgrade NPM to the latest version
\nnpm install npm -g
Verify NPM is latest version (at the time of writing this it is 6.9.0)
\nnpm list -g -depth=0
\n\nOutput should look similar to below (emphasis added):
\n
JMCOMBSMBP:~ jmcombs$ npm list -g -depth=0\n/Users/jmcombs/.npm-packages/lib\n└── npm@6.9.0\n
\nnpm -v
\n\nOutput should look similar to below (emphasis added):
\n
JMCOMBSMBP:~ jmcombs$ npm -v\n\\!h 6.9.0\n
Success
Sources used for this article:
\n\n