Howto install different versions of Node.js

Install the node version manager

Install n from npm:

$ sudo npm install -g n

Install version 0.12

$ sudo n 0.12.4

Install and switch to version 0.10.

$ sudo n 0.10.35

Now it’s possible to quickly switch between the Node.js version with the command n:

$ n

Switch Node.js version

Switch Node.js version

Check which version you are running:

$ node -v

Node.js version

Node.js version

PS!

You might need to update your node modules when switching Node.js version.

$ npm update --save

The –save updates your package.json as well

If update doesn’t work you might need to reinstall all your node modules

$ rm -rf node_modules/
$ npm install