Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global installation with npm doesn't work after Mac OS X Mavericks update

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!

like image 416
Misha Reyzlin Avatar asked Mar 21 '14 14:03

Misha Reyzlin


People also ask

Why is my npm install not working?

The Npm command not found error can appear when you install or upgrade npm. On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.

Does npm install work globally?

In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package. By default, npm install will install all modules listed as dependencies in package. json .

How install npm install globally?

Install Package Globally NPM can also install packages globally so that all the node. js application on that computer can import and use the installed packages. NPM installs global packages into /<User>/local/lib/node_modules folder. Apply -g in the install command to install package globally.


1 Answers

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.

like image 173
oraserrata Avatar answered Sep 18 '22 13:09

oraserrata