13

After upgrading to OS X 10.9 Mavericks, node wasn't found anymore in bash. I think I installed it with brew a while ago.

I decided to use the installer from node.js website. It went fine and both node and npm became available in bash. However, installing packages globally doesn't work.

The npm -g bin outputs following path /usr/local/bin.

However, after running npm install -g karma and invoking ls -la /usr/local/bin I can't see a symlink to the path where karma executable resides.

Running npm -g root returns /usr/local/lib/node_modules and after the installation I can see that karma module is there.

Not sure what I else I could check. Thanks!

Misha Reyzlin
  • 13,736
  • 4
  • 54
  • 63

7 Answers7

14

I found that the root cause of all of my npm install issues was the missing Xcode license agreement.

After the Maverick update, XCode upgraded as well and if you don't launch XCode, the license agreement will be missing.

Once I accepted the agreement, installs were successful.

Greg
  • 2,559
  • 4
  • 28
  • 46
8

I had the same problem due to not accepting the xcode license after upgrading to Mavericks. I was able to accept the new xcode license by running the following:

sudo xcodebuild -license

However, npm still was not working because symlink was not created, but trying to reinstall said npm was already there. I went ahead and:

brew remove npm

and then reinstalled with:

brew install npm

and I am back working again. Not a big fan of the reinstall, but I think the need to accept the xcode license left things in a hung state.

oraserrata
  • 389
  • 4
  • 7
2

I had the same problem - npm did not work after upgrading to mavericks. I tried all the above steps, but was still stuck. Specifically, when I tried to re-install node, I got the error:

Warning: The post-install step did not complete successfully You can try again using brew postinstall node

But running brew postinstall node responded:

Error: Permission denied - /usr/local/lib/node_modules/npm/AUTHORS

I tried removing all the node modules previously installed

sudo rm -rf /usr/local/lib/node_modules/

and then uninstalling and reinstalling node

and that finally got both node and npm working as before.

  • I was able to run `sudo brew postinstall node` brew error message provided this recommendation; only worked with `sudo` – raddrick Nov 10 '14 at 18:08
1

The problem seems to have occured because I tried to install packages that were previously on my system. The symlinks weren't created, probably because of that. Once I removed the packages and re-installed them (or tried to install packages I haven't had), they were added to /usr/local/bin as symlinks.

Misha Reyzlin
  • 13,736
  • 4
  • 54
  • 63
0

I had the same problem. After a maverick upgrade npm was not working, yet node itself was. I was not using the latest version as our team prefers to use 0.8.10.

In any case nvm, the node.js version manager, was still working. In this case I just reinstalled:

$ nvm install 0.8.21
######################################################################## 100.0%
Now using node v0.8.21
$ npm
Usage: npm <command>

where <command> is one of:
add-user, adduser, apihelp, author, bin, bugs, c, cache,
completion, config, ddp, dedupe, deprecate, docs, edit,
explore, faq, find, find-dupes, get, help, help-search,
home, i, info, init, install, isntall, issues, la, link,
list, ll, ln, login, ls, outdated, owner, pack, prefix,
prune, publish, r, rb, rebuild, remove, restart, rm, root,
run-script, s, se, search, set, show, shrinkwrap, star,
stars, start, stop, submodule, tag, test, tst, un,
uninstall, unlink, unpublish, unstar, up, update, version,
view, whoami

npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm faq          commonly asked questions
npm help <term>  search for help on <term>
npm help npm     involved overview

In the case where nvm was not working you might need to reinstall that, as well- ymmv

Cheruvim
  • 127
  • 1
  • 5
0

I am not sure if my answer was too late or not. I found myself in a difference situation than you. Hope that my experience an hour ago helps you.

my npm version (npm -v) is 1.4.28. First, I installed node.js on a computer with an administrator account. Then I created a user with administrator rights. When I tried to check the version of npm running, I failed to do so.

I searched the web and came across with this text. The original poster asked to check the path settings. I did not have node.js and npm installed with homebrew, another software that made me headache two months ago. I checked that I can run node. It is because node is located at /usr/local/bin, where all users have rights to execute programs. But for npm, it is in fact a link to ../lib/node_modules/npm/bin. However, the /usr/local/lib folder is not accessible by other users' but the administrator's account only.

I "sudo -i" and granted "chmod a+x ../lib" to it. Surprisingly, all folders' within have the correct execution right. I suspected that is some sorts of bug. I exited sudo and tried "npm -v" again. Succeed.

Hope that helps.

Tom K. C. Chiu
  • 776
  • 6
  • 17
0

In case the other solutions posted here do not work for you either, you may try out the approach suggested on this GitHub page. With a complete re-installation according to the insturctions on the page, I finally got npm (and an application, vs-mda-remote to be precise) working.

EDIT: This happened after updating from Mavericks to Yosemite.

Tacticus
  • 561
  • 11
  • 24