2016-02-15 88 views
0

我下面5 Min Quickstart - js - Angular 2指南,並呼籲「故宮開始」後得到一個奇怪的錯誤:角2 - NPM錯誤

> [email protected] start C:\Users\stavalfi\Desktop\plunkerExample 
> npm run lite 


> [email protected] lite C:\Users\stavalfi\Desktop\plunkerExample 
> lite-server 

'lite-server' is not recognized as an internal or external command, 
operable program or batch file. 

npm ERR! Windows_NT 6.1.7601 
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js 
" "run" "lite" 
npm ERR! node v0.12.2 
npm ERR! npm v2.7.4 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] lite: `lite-server` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] lite script 'lite-server'. 
npm ERR! This is most likely a problem with the angular2-quickstart package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  lite-server 
npm ERR! You can get their info via: 
npm ERR!  npm owner ls angular2-quickstart 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\stavalfi\Desktop\plunkerExample\npm-debug.log 

npm ERR! Windows_NT 6.1.7601 
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js 
" "start" 
npm ERR! node v0.12.2 
npm ERR! npm v2.7.4 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] start: `npm run lite` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] start script 'npm run lite'. 
npm ERR! This is most likely a problem with the angular2-quickstart package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  npm run lite 
npm ERR! You can get their info via: 
npm ERR!  npm owner ls angular2-quickstart 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\stavalfi\Desktop\plunkerExample\npm-debug.log 

更新:在安裝「NPM安裝精簡版服務器-g」,我得到的那些錯誤:

MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 
SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed else 
where. [C:\Users\stavalfi\AppData\Roaming\npm\node_modules\lite-server\node_modules\browser-sync\node_modules\socket.io\node_m 
odules\engine.io\node_modules\ws\node_modules\utf-8-validate\build\binding.sln] 
gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1 
gyp ERR! stack  at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269 
:23) 
gyp ERR! stack  at ChildProcess.emit (events.js:110:17) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (child_process.js:1074:12) 
gyp ERR! System Windows_NT 6.1.7601 
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" 

gyp ERR! cwd C:\Users\stavalfi\AppData\Roaming\npm\node_modules\lite-server\node_modules\browser-sync\node_modules\socket.io\nod 
e_modules\engine.io\node_modules\ws\node_modules\utf-8-validate 
gyp ERR! node -v v0.12.2 
gyp ERR! node-gyp -v v1.0.3 
gyp ERR! not ok 

> [email protected] install C:\Users\stavalfi\AppData\Roaming\npm\node_modules\lite-server\node_modules\browser-sync\node_modules 
\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil 
> node-gyp rebuild 

回答

0

錯誤代碼ENOENT表示 「沒有這樣的文件或目錄」。

你應該檢查你有文件C:\Users\stavalfi\package.json目前和應用程序可以訪問...你是否在正確的文件夾執行命令?

+0

包沒有位於正確的位置。但現在我得到新的錯誤。任何額外的幫助將被祝福! –

+0

我會說你的lite服務器沒有全局安裝。嘗試使用'-g'選項:npm install lite-server -g –

+0

這樣做,並得到一些奇怪的錯誤。我確實有VS 2015,我認爲它帶有C++編譯器。 –

0

你試過更新npm嗎?我在5分鐘快速入門時遇到了一些其他問題,但在更新npm之後,我可以運行npm start,而不會出現任何錯誤。