我试过通过全局安装快件生成器,但找不到。
我试着打开一个新的CMD / Powershell,同样的事情也发生了。
PS C:\Users\testuser\testme> npm install -g express-generator
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
npm http GET https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/keypress
npm http GET https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/minimist
C:\ProgramData\chocolatey\lib\nodejs.commandline.0.10.31\tools\express -> C:\ProgramData\chocolatey\
lib\nodejs.commandline.0.10.31\tools\node_modules\express-generator\bin\express
express-generator@4.9.0 C:\ProgramData\chocolatey\lib\nodejs.commandline.0.10.31\tools\node_modules\
express-generator
├── commander@1.3.2 (keypress@0.1.0)
└── mkdirp@0.5.0 (minimist@0.0.8)
PS C:\Users\testuser\testme> express
express : The term 'express' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.
At line:1 char:1
+ express
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (express:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\testuser\testme>
这已在全球范围内安装。
有什么想法吗?
发布于 2014-12-03 23:45:45
检查您的PATH
以确保它包括全局安装模块的位置。
在命令提示符下:
npm ls -g --depth=0
并注意输出第一行上的目录PATH
以查看步骤#1
中找到的目录是否在路径中.如果(当) npm
全局安装目录从您的PATH
中丢失,那么添加它应该可以修复这个问题。
查看另一个StackOverflow问题作为参考:Grunt on Windows 8: 'grunt' is not recognized
https://stackoverflow.com/questions/27272179
复制相似问题