Error: The ‘brew link’ step did not complete successfully

I run Mac OS X Mavericks. I tried 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_modules

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

Leave a Comment