Install NodeJS and NPM on Mac
Published: 2019-10-19
This will install node v10.16.3
and npm v6.9.0
.
-
Download tarball from NodeJS downloads
curl -O -L https://nodejs.org/dist/v10.16.3/node-v10.16.3-darwin-x64.tar.gz
-
Make dir then extract tarball
mkdir -p ~/bin/nodejs tar -v -x -C ~/bin/nodejs -f node-v10.16.3-darwin-x64.tar.gz
-
Set environment variables in your bash config file, e.g.
~/.bash_profile
export NODEJS_HOME=$HOME/bin/nodejs/node-v10.16.3-darwin-x64 export PATH=$NODEJS_HOME/bin:$PATH
-
Source bash config file
source ~/.bash_profile
-
Confirm installation
node --version npm --version