Node and NPM no longer work after Mavericks update.

July 2nd, 2014

node-npm

I have had this issue a few times lately. I finally updated to Mavericks and low and behold node and npm no longer seem to work.

After updating to Mavericks, running node or the name of any npm package produced -bash: node: command not found

Here is how I went about getting it back up and running. These are a few ways I have found this that worked on all the computers I had this issue with.

Checking if node is in the $PATH

I have found this method successful a few times, but not as of late. Running:


echo $PATH

Will let you know which folders are exposed. If you know where your install of node is and you don’t see it there, you can add that location back like this:


PATH=$PATH:/the/path/you/want

If this works, great! If not lets look at something else that helped me.

Xcode

If you just installed a new version of Xcode, you might have to agree to the new license agreement. Simply opening up Xcode will prompt this for you. After that things should be working. If not, try the next step.

Homebrew

First thing you will need is the make sure you have Homebrew installed. If you don’t simply go to their site and follow the instructions. Or use this command in your terminal.


ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Homebrew lets you install packages you might want to use, just like npm.

If you already had Homebrew installed, run brew doctor and then brew update. This will update your copy of Homebrew, and also repair any thing that is out of place.

Running brew install node might output Warning: node-0.10.29 already installed If so we you should uninstall it running brew uninstall node and then install again.

You might be asked to force it to uninstall, if so proceed with doing so.

Hopefully after all that node and npm should now be working.

Linking up your npm modules

I found that after installing node and npm again, packages that were already installed did not work. Running npm update -g updates the packages and makes any packages that were not available now available.

I hope that one of those worked for you. If you have another method that helped you out, please feel free to leave a comment with the method that worked for you.


Warning: count(): Parameter must be an array or an object that implements Countable in /home/ryanch6/public_html/wp-includes/class-wp-comment-query.php on line 405