Last night i started to use Brew on my Mac.
Brew is a Ruby based package management app for OSA, and the reason was so that I could have a more controlled package management with Node, NPM etc.
Unfortunately I had previously installed Node directly so needed to remove it so that I could reinstall it through Brew. That's where the trouble started. But, after a bit of googling around I finally found this stackoverflow page and followed these steps.
I run Mac OS X Mavericks while trying to install node 0.10.25 and the top answer did not work for me.
natevw says to
rm -rf /usr/local/lib/node_modules/npm but if the permissions on
/usr/local/lib/node_modules look like this:
drwxr-xr-x 3 root admin 102 Feb 2 20:45 node_modules
then brew will not be able to create its npm symlink in that directory. Here's my solution:
Step 1: Update Homebrew
$ brew update
Step 2: Remove node/npm everywhere on your system
Some of these commands are not necessary depending on how you installed node/npm in the past.
$ brew uninstall npm $ brew uninstall node $ npm uninstall npm -g $ sudo rm -rf /usr/local/lib/node_module
Note: I had stray node files that I found by running
brew -v link node (which gave me the verbose output of the linking errors brew was complaining about). You may need to:
$ sudo rm -rf /usr/local/include/node $ sudo rm -rf /usr/local/lib/node
Step 3: Open a new terminal and install node
$ brew install node
After that (taking careful attention to restart the terminal in the middle) everything worked fine.