2014-12-03 46 views
1

我试图通过全局安装Express-Generator,但找不到它。谁能帮忙?在Windows上找不到全局安装的Express.JS

我试过打开一个新的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 
[email protected] C:\ProgramData\chocolatey\lib\nodejs.commandline.0.10.31\tools\node_modules\ 
express-generator 
├── [email protected] ([email protected]) 
└── [email protected] ([email protected]) 
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> 

这已在全球范围内安装。

任何想法?

+0

请检查C:\用户\ testuser的\应用程序数据\漫游\ NPM快车的可执行文件(应该是两个文件) – mvuajua 2014-12-03 16:36:04

回答

2

请检查您的PATH以确保它包含全球安装模块的位置。

在命令提示:

  1. 类型npm ls -g --depth=0并注意印在输出
  2. PATH类型的第一行中的目录,以查看是否在步骤#1发现该目录是在路径...

如果(何时)npm全局安装目录从您的PATH中缺失,则添加它应该可以解决问题。

看到这个其他的StackOverflow问题作为参考:Grunt on Windows 8: 'grunt' is not recognized

+0

不错,正是我需要的。很棒。谢谢。奇怪它并没有被默认添加。 – Martin 2014-12-05 07:14:19

相关问题