npm installing executable in usr/local/share/npm/bin rather than usr/local/bin

Tag: node.js , npm Author: sunshinewenrou Date: 2014-02-08

For example I tried installing npm serve globally

$ npm install -g serve

but after seemingly successfully installing it, I was unable to run the serve executable. Seems like the command just could not be found. Turns out the exe serve file was located in:


rather than in what I thought should be (where all the other executable files are):


Any idea why I can't seem to get this to work?

Best Answer

Similar to this answer, create/edit ~/.npmrc to include:

prefix = /usr/local/bin


prefix = /usr/local