admin管理员组

文章数量:1401937

so I did npm install express according to the tutorial, after installing express I did

'express --version' 

and express is not in my path. I am wondering what I did wrong or is there any way to test if express works on my OS.

so I did npm install express according to the tutorial, after installing express I did

'express --version' 

and express is not in my path. I am wondering what I did wrong or is there any way to test if express works on my OS.

Share Improve this question edited Apr 16, 2011 at 11:28 MPelletier 16.7k18 gold badges89 silver badges140 bronze badges asked Apr 7, 2011 at 16:31 ericraioericraio 1,46914 silver badges35 bronze badges 1
  • install express via npm? – Alfred Commented Apr 7, 2011 at 22:22
Add a ment  | 

3 Answers 3

Reset to default 9

Did you use npm install express or npm install express -g?

The second mand is what you should use if you want to use the express program from the mand line. The -g option installs the library globally.

The first mand will just install the library in a node_modules subfolder, and you would need to explicitly locate the program before using it, eg. node ./node_modules/express/bin/express (I'm not sure if that's the right mand, just an example).

Did you try adding the path to the npm's bin directory to your PATH?

export PATH="/usr/local/share/npm/bin:$PATH"

Create a directory and execute: $ npm install -g express

If you want to generate an application with EJS, Stylus etc simply execute:

$ express --sessions --css stylus --ejs yourapp

本文标签: javascriptExpressJS InstallationStack Overflow