Installing (and Fixing) Node, NPM and maybe Grunt on OSX

  Terminal  
 Dec 2015

Problems with Node? It’s not uncommon.

So, have you got the latest version?

node -v
v0.10.28
npm -v
0.01

OK, that’s not good. Even if you have newish versions though and you can’t get it working it’s often best just to start from scratch.

Clear Node & NPM

sudo rm -rf  /usr/local/lib/node_modules/npm/
brew uninstall node

Now try: node -v Still installed? brew uninstall again (you might have installed from the DMG or something).

Now check your setup:

brew doctor

If you have any Broken symlinks prune them: brew prune Keep going round those loops till Node is gone.

Reinstall with Homebrew

brew install node

node -v
v5.1.1
npm -v
3.3.12

Ok? better.

Updating Node

From time to time, you need to update, Homebrew has you covered:

brew update
brew doctor
# clear up any issues
brew upgrade node

Which should update Node and NPM.

Grunt

Frequently, you will want to clone an existing project and start work. If it depends on grunt you will need to install the project dependencies:

# install grunt globaly (by putting it in your path)
npm install -g grunt-cli    

# install project dependencies
cd /project
npm install

Hopefully all done. You should be able to run Grunt now.


Web Development

Got a web project you need doing well? We can help with that!

Find out more