Search code examples
node.jsionic-frameworkosx-elcapitan

Node.js 4 and Node 5 on the same machine running OS X "EL Capitan"


I am about to get started with the ionic framework and they stated on their website that they require Node.js 4 and Node 5 does not work at the moment!.

Bummer!! That sounds like a downgrade.

I was wondering what would the best, if there is one, setup to have both, Node 4 and Node 5, installed on my Mac OS X El Capitan and how would I use they.

I would consider VM environments too, but I would like to explore the possibilities on my machine first.

Please advise!


Solution

  • You might be looking for a version manager. There are two in particular for node.js

    nvm and n.

    They both allow you to install different versions of node.js and subsequently switch them at will.

    You can install a specific version of node with the following commands:

    nvm install 5.0
    n 5.0
    

    They both share the similar use command to switch installed versions:

    nvm use 5.0
    n use 5.0
    

    A nice feature of n is that it displays installed versions if you just type n and allows you to interactively switch them.

    enter image description here