Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-bash: express: command not found after installing express and express-generator with NPM

I have a server with NodeJS and NPM already installed. Then process to install Express with NPM:

$ npm install express -g

It answered:

root@server ~ $ npm install express -g
npm http GET https://registry.npmjs.org/express
npm http 200 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/depd/0.4.5
npm http GET https://registry.npmjs.org/escape-html/1.0.1
npm http GET https://registry.npmjs.org/parseurl
npm http GET https://registry.npmjs.org/on-finished
npm http GET https://registry.npmjs.org/methods/1.1.0
npm http GET https://registry.npmjs.org/path-to-regexp/0.1.3
npm http GET https://registry.npmjs.org/fresh/0.2.4
npm http GET https://registry.npmjs.org/media-typer/0.3.0
npm http GET https://registry.npmjs.org/proxy-addr
npm http GET https://registry.npmjs.org/range-parser
npm http GET https://registry.npmjs.org/qs/2.2.4
npm http GET https://registry.npmjs.org/serve-static
npm http GET https://registry.npmjs.org/send/0.9.3
npm http GET https://registry.npmjs.org/type-is
npm http GET https://registry.npmjs.org/vary
npm http GET https://registry.npmjs.org/cookie/0.1.2
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/on-finished
npm http 304 https://registry.npmjs.org/escape-html/1.0.1
npm http GET https://registry.npmjs.org/merge-descriptors/0.0.2
npm http GET https://registry.npmjs.org/utils-merge/1.0.0
npm http GET https://registry.npmjs.org/finalhandler/0.2.0
npm http GET https://registry.npmjs.org/accepts
npm http GET https://registry.npmjs.org/etag
npm http 304 https://registry.npmjs.org/methods/1.1.0
npm http 304 https://registry.npmjs.org/depd/0.4.5
npm http 304 https://registry.npmjs.org/range-parser
npm http GET https://registry.npmjs.org/cookie-signature/1.0.5
npm http 304 https://registry.npmjs.org/proxy-addr
npm http 304 https://registry.npmjs.org/serve-static
npm http 304 https://registry.npmjs.org/fresh/0.2.4
npm http 304 https://registry.npmjs.org/type-is
npm http 304 https://registry.npmjs.org/media-typer/0.3.0
npm http 304 https://registry.npmjs.org/send/0.9.3
npm http 304 https://registry.npmjs.org/qs/2.2.4
npm http 304 https://registry.npmjs.org/vary
npm http 304 https://registry.npmjs.org/merge-descriptors/0.0.2
npm http 304 https://registry.npmjs.org/cookie/0.1.2
npm http 304 https://registry.npmjs.org/utils-merge/1.0.0
npm http 304 https://registry.npmjs.org/finalhandler/0.2.0
npm http 304 https://registry.npmjs.org/accepts
npm http 304 https://registry.npmjs.org/etag
npm http 304 https://registry.npmjs.org/cookie-signature/1.0.5
npm http 304 https://registry.npmjs.org/parseurl
npm http 304 https://registry.npmjs.org/path-to-regexp/0.1.3
npm http GET https://registry.npmjs.org/ee-first/1.0.5
npm http GET https://registry.npmjs.org/mime-types
npm http GET https://registry.npmjs.org/crc/3.0.0
npm http GET https://registry.npmjs.org/negotiator/0.4.9
npm http GET https://registry.npmjs.org/forwarded
npm http GET https://registry.npmjs.org/ipaddr.js/0.1.3
npm http GET https://registry.npmjs.org/ms/0.6.2
npm http GET https://registry.npmjs.org/destroy/1.0.3
npm http GET https://registry.npmjs.org/mime/1.2.11
npm http 304 https://registry.npmjs.org/mime-types
npm http 304 https://registry.npmjs.org/forwarded
npm http 304 https://registry.npmjs.org/negotiator/0.4.9
npm http 304 https://registry.npmjs.org/ipaddr.js/0.1.3
npm http 304 https://registry.npmjs.org/crc/3.0.0
npm http 304 https://registry.npmjs.org/ee-first/1.0.5
npm http 304 https://registry.npmjs.org/ms/0.6.2
npm http 304 https://registry.npmjs.org/mime/1.2.11
npm http 304 https://registry.npmjs.org/destroy/1.0.3
npm http GET https://registry.npmjs.org/mime-db
npm http 304 https://registry.npmjs.org/mime-db
[email protected] /var/www/site/npm/lib/node_modules/express
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected])

and also

$ npm install express-generator -g

It answered:

root@server ~ $ npm install express-generator -g
npm http GET https://registry.npmjs.org/express-generator
npm http 304 https://registry.npmjs.org/express-generator
npm http GET https://registry.npmjs.org/commander/1.3.2
npm http GET https://registry.npmjs.org/mkdirp/0.5.0
npm http 304 https://registry.npmjs.org/mkdirp/0.5.0
npm http 304 https://registry.npmjs.org/commander/1.3.2
npm http GET https://registry.npmjs.org/keypress
npm http GET https://registry.npmjs.org/minimist/0.0.8
npm http 200 https://registry.npmjs.org/minimist/0.0.8
npm http GET https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz
npm http 304 https://registry.npmjs.org/keypress
npm http 200 https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz
/var/www/site/npm/bin/express -> /var/www/site/npm/lib/node_modules/express-generator/bin/express
[email protected] /var/www/site/npm/lib/node_modules/express-generator
├── [email protected] ([email protected])
└── [email protected] ([email protected])

and all good up here, at least I no errors. Now the problem arises when I want to use express:

$ express myapp

It answered:

-bash: express: command not found

Usually this problem occurs when there is express-generator was installed, and the install is solved, but it is not me =(. If anyone has any idea what I can do, will thank you.

NodeJS version: v0.11.13-pre NPM Version: 1.4.6

Ps: All these commands I ran as the root

Ps2: Sorry for my bad english

like image 594
Ernesto Rojas Avatar asked Dec 11 '25 00:12

Ernesto Rojas


1 Answers

Installing express-generator, we see

/var/www/site/npm/bin/express -> /var/www/site/npm/lib/node_modules/express-generator/bin/express

Add /var/www/site/npm/bin to your $PATH

like image 153
glenn jackman Avatar answered Dec 12 '25 15:12

glenn jackman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!