node.js - 'express' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
高洛峰
高洛峰 2017-04-17 11:18:50
0
3
670

express版本是4.9.5
express-generator版本是4.9.5
然后在cmd中输入express -h就出现'express' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
迷茫

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
C:UsersxxxAppDataRoamingnpm Then add %NODE_PATH%

at the end of 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.

黄舟

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

小葫芦

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 -vtest 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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template