

Thankfully nvm offers to ways to accomplish that. This is something you want to automate since releases of Node.js are pretty frequent (for a good reason). Please note that you have to install global packages with every node version your are using with nvm. In place of a version pointer like “6”, you can use the special default aliases like “stable” and “unstable”: nvm install stable You will use the latest installed version automatically after installation. Let’s install the latest v5.x.x release in addition: nvm install 5 To download, compile, and install the (currently) latest v6.x.x release of node, do this: nvm install 6 In case of the homebrew installation it is: export NVM_DIR=~/.nvm Please have a look at in case you would like to do a manual install.Įither way you have to add a few lines to your ~/.bash_profile, ~/.zshrc or ~/.profile. I prefer installing it via homebrew: $ brew update Installing the Node Version Manager (nvm)

Do yourself a favor and remove that to prevent possible issues with linking globale packages via npm link. Potential problems with linking global packagesĭouble check if there still is a node_modules directory in /usr/local/lib holding your globally installed packages. Let’s get rid of this and older versions in the cellar of homebrew: $ brew uninstall -force node But I have to be able to use a different Node version just in case thinks break with Node 4.0.įirst we could check which version of node we are using: $ node -v This became more important since the stable release of Node 4.0 which I like to use. But beside the quirk when it comes to updating npm there is a method which makes switching Node.js version even easier. Sure you can just use homebrew to update your Node.js installation when there are new releases.
