Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

express command not found in bash after installing it with npm

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?

like image 313
Sander Avatar asked May 23 '11 21:05

Sander


People also ask

Why npm install command is 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.

What is npm install Express?

Express is a web application framework of node js. It offers a range of features for building mobile and web applications - from building a single page, to multipages, and an entire hybrid web application.

Which command is used to install Express js?

Use the following command to install express: npm install express --save.


2 Answers

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

like image 150
Fazi Avatar answered Oct 08 '22 16:10

Fazi


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

like image 30
Raynos Avatar answered Oct 08 '22 14:10

Raynos