I recently installed Node.js and npm module on OSX and have a problem with the settings I think:
npm install [MODULE] is not installing the node.js module to the default path
which is /usr/local/lib/node_modules.
I recently installed Node.js and npm module on OSX and have a problem with the settings I think:
npm install [MODULE] is not installing the node.js module to the default path
which is /usr/local/lib/node_modules.
You might not have write permissions to install a node module in the global location such as
/usr/local/lib/node_modules
, in which case run npm install -g package as root.On a Mac, I found the output contained the information I was looking for:
After adding
/usr/local/share/npm/bin
to theexport PATH
line in my.bash_profile
, saving it, andsource
ing it, I was able to runnormally.
In Ubuntu, set path of node_modules in .bashrc file
I like using a package.json file in the root of your app folder.
Here is one I use
http://pastie.org/3232212
If you want to install a npm module globally, make sure to use the new
-g
flag, for example:npm install forever -g
The general recommendations concerning npm module installation since 1.0rc (taken from blog.nodejs.org):
I just recently used this recommendations and it went down pretty smoothly. I installed forever globally (since it is a command line tool) and all my application modules locally.
However, if you want to use some modules globally (i.e. express or mongodb), take this advice (also taken from blog.nodejs.org):
I did not test one of those variations, but they seem to be pretty straightforward.
I had issues installing Express on Ubuntu:
If for some reason NPM command is missing, test npm command with
npm help
. If not there, follow these steps - http://arnolog.net/post/8424207595/installing-node-js-npm-express-mongoose-on-ubuntuIf just the Express command is not working, try:
This made everything work as I'm used to with Windows7 and OSX.
Hope this helps!