Install Node with NVM

Continue from my previous story — uninstalling broken npm and node altogether, now we will talk about installing node with nvm.

Setting up nvm, node & npm on OS X Mavericks
How To Install Node.js with NVM (Node Version Manager) on a VPS

Install NVM

Well, of course we’re using homebrew.

$ brew update && brew upgrade
$ brew install nvm
$ echo -e "export NVM_DIR=~/.nvm\nsource $(brew --prefix nvm)/nvm.sh" >> ~/.bash_profile

Install Node

$ nvm install stable
$ nvm use stable

All done!

Next you probably want to start installing what you’ve been installed with npm, again. Probably, just probably:

$ npm install -g yo grunt bower generator-angular
$ npm install -g jshint

Symlink your node + npm to a standard location

You probably need to aware that your node & npm are no longer reside at the same place as it was before. Try

$ which node

You should some something like

~/.nvm/versions/node/<version>/bin/node

So do npm, and also node_modules. You can try

$ n=$(which node); n=${n%/bin/node}; ln -s $n/bin/* /usr/local/bin; ln -s $n/lib/node_modules /usr/local/lib

Your new node path will look like:

$ which node
/usr/local/bin/node

Enjoy!

Show your support

Clapping shows how much you appreciated Justin Moh’s story.