Development is picking pace and Node.js is shipping out a new version frequently. It is nice to have the latest version at hand in your development environment to test out new features.
There are a few ways to install Node.js. One of the obvious ones is to simply download the installer fromnodejs.org. However, you might not want to be downloading new installer every time there’s a new version out.
Here are few alternative ways to update to the latest version of Node.js on a Mac.
Nvm
Nvmis a script-based node version manager. You can install it easily with a curl and bash one-liner as described in the documentation. It’s also available on Homebrew.
Assuming you have successfully installed nvm. The following will install the latest version of node.
1 nvm install node --reinstall-packages-from=node
The last option installs all global npm packages over to your new version. This way packages likemochaandnode-inspectorkeep working.
N
Nis an npm-based node version manager. You can install it by installing first some version of node and then runningnpm install -g n
.
Assuming you have successfully installed n. The following will install the latest version of node.
1 sudo n latest
Homebrew
Homebrewis one of the two popular package managers for Mac. Assuming you have previously installed node withbrew install node
. You can get up-to-date with formulae and upgrade to the latest Node.js version with the following.
1 brew update
2 brew upgrade node
MacPorts
MacPortsis the another package manager for Mac. The following will update the local ports tree to get access to updated versions. Then it will install the latest version of Node.js. This works even if you have previous version of the package installed.
1 sudo port selfupdate
2 sudo port install nodejs-devel
There exists alsonodejs
alternativepackagethat follows the long term support line.
Similar Posts:
- How to Solve Error Permission denied when running brew cleanup
- How to Solve ModuleNotFoundError: No module named ‘pip._internal’
- Completely Uninstall Node.js from Mac OS X
- Android4.4 xposed Install error: the xposed framework is not installed)
- How to Solve docker run Error: oci runtime error
- error: command ‘gcc’ failed with exit status 1 [How to Solve]
- Node is not handled by link after installation [How to Solve]
- [Solved] Appium+Xcode+ios:ideviceinstaller -l: “Could not connect to lockdownd. Exiting.”
- [Solved] Brew Install MongoDB Error: “Error: No available formula with the name “mongodb””
- [Solved] Apt-get -f install Error: No apport report written because MaxReports is reached already Errors were…