In Ubuntu, set path of node_modules in .bashrc file
export PATH="/home/username/node_modules/.bin:$PATH"
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-ubuntu
If just the Express command is not working, try:
sudo npm install -g express
This made everything work as I'm used to with Windows7 and OSX.
Hope this helps!
You need to have superuser privileges,
sudo npm install -g <package name>
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:
$> npm install -g karma
...
...
> [email protected] install /usr/local/share/npm/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
...
$> ls /usr/local/share/npm/bin
karma nf
After adding /usr/local/share/npm/bin
to the export PATH
line in my .bash_profile
, saving it, and source
ing it, I was able to run
$> karma --help
normally.
I like using a package.json file in the root of your app folder.
Here is one I use
nvm use v0.6.4
npm install
Source: Stackoverflow.com