express command not found in bash after installing it with npm


Question

just installed new ubuntu vm to test around with node installed things in this order:

node
mongodb-server
npm
express
mongoose

now, trying to create a new app i noticed express cannot be used in the shell. express -v returns express: command not found

i installed npm like this

curl http://npmjs.org/install.sh | sudo sh

and i installed express this way

npm install express

any ideas?

1
27
5/23/2011 9:14:33 PM

Accepted Answer

npm install express -g

You need to install it globally.

Npm 1.0 installs modules locally by default. So the bash executable lives in /node_modules/bin/. You can add that folder to PATH or you can just install express globally so that it's picked up by PATH

39
5/23/2011 9:32:20 PM

Starting from express 4.00 you also need to install express generator with:

npm install -g express-generator

Only after this will you be able to run express as a command!

For confirmation see: ExpressJS.com - Migrating to Express 4


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon