The Best Way to Install Node Js Npm and Yarn on Mac Osx

The best way to install Node.js on Mac is nvm.

https://github.com/creationix/nvm You can use the install script for nvm installation. $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash relaunch your Terminals and check nvm version $ nvm --version

List your installed node versions if any: $ nvm list

It is safe if you choose one of the most recent LTS (long time support) version and install it with the following command: $ nvm install <node-version>

Setup this version as the default. $ nvm use <node-version>

Check your node version with $ node -v

In case, you want to upgrade node $ nvm install <node-version> --reinstall-packages-from=<old-node-version>

To Uninstall Node $ nvm uninstall <node-version>

Switching between various nodes versions $ nvm use <node-version> $ nvm use node (switch to latest Node.js version)

NPM

npm is installed as a package with Node Check the version $ npm -v

To upgrade npm $ npm install -g npm

Yarn

To install yarn $ npm install -g yarn

Check the version $ yarn -v

https://medium.com/@itsromiljain/the-best-way-to-install-node-js-npm-and-yarn-on-mac-osx-4d8a8544987a