2014-12-03 43 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

相關問題