I have had this issue a few times lately. I finally updated to Mavericks and low and behold
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:
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:
If this works, great! If not lets look at something else that helped me.
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.
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.
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
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.