ExpressJS Installation
so I did npm install express according to the tutorial, after installing express I did
'expres开发者_Python百科s --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.
Did you use npm install express
or npm install express -g
?
The second command is what you should use if you want to use the express program from the command line. The -g
option installs the library globally.
The first command 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 command, 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
精彩评论