- Do not install global modules with this version.
- Now that nvm is installed, we can install multiple versions of node.
- How To Manage Multiple Node Versions Efficently
- Follow the same steps as above for system node to upgrade or uninstall nvm.
- Mac OSX: Using brew
node-tips – Tips for working on node/npm projects.
@MaevaRalafi: How do you manage multiple versions of #nodejs? You use #nvm.
The more you work with Nodejs projects, the more you will realize that you need multiple versions of Nodejs and NPM (and their respective Global modules) to run different projects. In my experience, you might need at least two(2) major versions of Node.
I propose the following solution. Note that this is not the only solution but this is a way I found to be best in maintaining the node versions that I require in a logical and streamlined manner, in my humble opinion.
Of course, others might have a different ways and solutions and that is totally okay. As developers, we know that there are many ways to solve one problem. But if you are interested in my way, I invite you to keep reading.
Node as the root Node. It is not necessary to have it, but it is convenient to have as a quick “go-to” version. In fact, we can even skip this step altogether.
Node/NPM should not be used for creating and maintaining projects directly. Therefore, do not install global modules with this version. The only modules that should show up when running
as another OSX package.
node version, simply run the following.
is always helpful.
Verify that the system node and npm works correctly:
$ npm -v
NVM is the Node Version Manager. It allows to maintain multiple versions of node/npm and switch back and forth between those versions as projects requires.
To install NVM, run the following:
Note: Follow the same steps as above for system node to upgrade or uninstall nvm.
source from the terminal:
Verify that the system nvm works correctly:
Now that nvm is installed, we can install multiple versions of node. To check for the available versions to install:
To install versions of node (e.g. v7.4.0 and v6.9.4):
To check which versions are currently installed on our system (The currently used is pointed by an arrow):
To swith to a different installed version (e.g. from v7.4.0 to v6.9.4)
To verify which node/npm is currently being use, we can simply check them again.
To upgrade to a new version and move the global modules to the new version: (e.g. from v6.8.0 to v6.9.4)
And finally, to uninstall a version altogether, without upgrading: