express版本是4.9.5
express-generator版本是4.9.5
然后在cmd中输入express -h就出现'express' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
迷茫2017-04-17 11:20:50
I am running Windows 7. I have encountered this before and solved it like this. I hope it will be useful. Add NODE_PATH to the environment variable
at the end of PATH
C:UsersxxxAppDataRoamingnpm Then add %NODE_PATH%
Under Windows, I also encountered the problem that the command could not be executed after express was installed. Just tried it, express-generator can be successful. Thanks.
npm install -g express-generator
https://cnodejs.org/topic/51dc1383d44cbfa304181253
Please make good use of search engines.
黄舟2017-04-17 11:20:50
How to install express
?
If you want to use the module from the command line, you need to install it globally.
Try npm install -g express
and run the express command
高洛峰2017-04-17 11:20:50
When I read "Node.js Classic Introduction" again today, I installed express through npm according to the textbook,
express -g express
Run the command line again
express express_example
When I tried, I reported the error "express is not an internal or external command". Later, I searched on Google for a solution:
It turns out that the default express installation is the latest version, which is already version 4.x.x. In the latest express4.0+ version, the command tool is separated, so express-generator must be installed. The solution is to execute the command line:
npm install -g express-generator
Wait until the installation is completed, and then express -v
test whether the installation is successful~
It is usually no problem, unless you first installed express locally instead of "-g". In that case, You can refer to here