2017-03-17 107 views
0

我一直在試圖做Angular 2快速入門教程。我從字面上克隆了這個項目,安裝了它並嘗試啓動它,並且它給了我下面的問題。我在Ubuntu VM上運行它,它工作得很好,但它並沒有在Windows上工作。我在下面包含錯誤信息。謝謝!Angular2 quickstart不能在windows上工作

0 info it worked if it ends with ok 
1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\node.exe', 
1 verbose cli 'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 
1 verbose cli 'run', 
1 verbose cli 'serve' ] 
2 info using [email protected] 
3 info using [email protected] 
4 verbose run-script [ 'preserve', 'serve', 'postserve' ] 
5 info lifecycle [email protected]~preserve: [email protected] 
6 silly lifecycle [email protected]~preserve: no script for preserve, continuing 
7 info lifecycle [email protected]~serve: [email protected] 
8 verbose lifecycle [email protected]~serve: unsafe-perm in lifecycle true 
9 verbose lifecycle [email protected]~serve: PATH: C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\Ahmer\My Documents\quickstart\node_modules\.bin;C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\Ahmer\My Documents\quickstart\node_modules\.bin;C:\Users\Ahmer\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Ahmer\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Git\cmd;C:\Users\Ahmer\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files (x86)\nodejs;C:\Users\Ahmer\Anaconda3;C:\Users\Ahmer\Anaconda3\Scripts;C:\Users\Ahmer\Anaconda3\Library\bin;C:\Users\Ahmer\AppData\Local\Microsoft\WindowsApps;C:\Users\Ahmer\AppData\Local\atom\bin;C:\Users\Ahmer\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl 
10 verbose lifecycle [email protected]~serve: CWD: C:\Users\Ahmer\My Documents\quickstart 
11 silly lifecycle [email protected]~serve: Args: [ '/d /s /c', 'lite-server -c=bs-config.json' ] 
12 silly lifecycle [email protected]~serve: Returned: code: 1 signal: null 
13 info lifecycle [email protected]~serve: Failed to exec serve script 
14 verbose stack Error: [email protected] serve: `lite-server -c=bs-config.json` 
14 verbose stack Exit status 1 
14 verbose stack  at EventEmitter.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at EventEmitter.emit (events.js:191:7) 
14 verbose stack  at ChildProcess.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\spawn.js:40:14) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at ChildProcess.emit (events.js:191:7) 
14 verbose stack  at maybeClose (internal/child_process.js:877:16) 
14 verbose stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 
15 verbose pkgid [email protected] 
16 verbose cwd C:\Users\Ahmer\My Documents\quickstart 
17 error Windows_NT 10.0.14393 
18 error argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "serve" 
19 error node v6.10.0 
20 error npm v3.10.10 
21 error code ELIFECYCLE 
22 error [email protected] serve: `lite-server -c=bs-config.json` 
22 error Exit status 1 
23 error Failed at the [email protected] serve script 'lite-server -c=bs-config.json'. 
23 error Make sure you have the latest version of node.js and npm installed. 
23 error If you do, this is most likely a problem with the angular-quickstart package, 
23 error not with npm itself. 
23 error Tell the author that this fails on your system: 
23 error  lite-server -c=bs-config.json 
23 error You can get information on how to open an issue for this project with: 
23 error  npm bugs angular-quickstart 
23 error Or if that isn't available, you can get their info via: 
23 error  npm owner ls angular-quickstart 
23 error There is likely additional logging output above. 
24 verbose exit [ 1, true ] 

---------------------------------------------------------------------------- 
$ npm start 

> [email protected] prestart C:\Users\Ahmer\My Documents\quickstart 
> npm run build 


> [email protected] build C:\Users\Ahmer\My Documents\quickstart 
> tsc -p src/ 


> [email protected] start C:\Users\Ahmer\My Documents\quickstart 
> concurrently "npm run build:watch" "npm run serve" 

[0] 
[0] > [email protected] build:watch C:\Users\Ahmer\My Documents\quickstart 
[0] > tsc -p src/ -w 
[0] 
[1] 
[1] > [email protected] serve C:\Users\Ahmer\My Documents\quickstart 
[1] > lite-server -c=bs-config.json 
[1] 
[1] ** browser-sync config ** 
[1] { injectChanges: false, 
[1] files: [ './**/*.{html,htm,css,js}' ], 
[1] watchOptions: { ignored: 'node_modules' }, 
[1] server: 
[1] { baseDir: 'src', 
[1]  middleware: [ [Function], [Function] ], 
[1]  routes: { '/node_modules': 'node_modules' } } } 
[0] 9:44:32 AM - Compilation complete. Watching for file changes. 
[1] events.js:160 
[1]  throw er; // Unhandled 'error' event 
[1]  ^
[1] 
[1] Error: watch karma-test-shim.js EPERM 
[1]  at exports._errnoException (util.js:1022:11) 
[1]  at FSWatcher.start (fs.js:1429:19) 
[1]  at Object.fs.watch (fs.js:1456:11) 
[1]  at createFsWatchInstance (C:\Users\Ahmer\Documents\quickstart\node_modules\chokidar\                         lib\nodefs-handler.js:37:15) 
[1]  at setFsWatchListener (C:\Users\Ahmer\Documents\quickstart\node_modules\chokidar\lib                         \nodefs-handler.js:80:15) 
[1]  at FSWatcher.NodeFsHandler._watchWithNodeFs (C:\Users\Ahmer\Documents\quickstart\nod                         e_modules\chokidar\lib\nodefs-handler.js:228:14) 
[1]  at FSWatcher.NodeFsHandler._handleFile (C:\Users\Ahmer\Documents\quickstart\node_mod                         ules\chokidar\lib\nodefs-handler.js:255:21) 
[1]  at FSWatcher.<anonymous> (C:\Users\Ahmer\Documents\quickstart\node_modules\chokidar\                         lib\nodefs-handler.js:473:21) 
[1]  at FSReqWrap.oncomplete (fs.js:123:15) 
[1] 
[1] npm 
[1] ERR! Windows_NT 10.0.14393 
[1] npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\node                         js\\node_modules\\npm\\bin\\npm-cli.js" "run" "serve" 
[1] npm ERR! node v6.10.0 
[1] npm ERR! 
[1] npm v3.10.10 
[1] npm ERR! 
[1] code ELIFECYCLE 
[1] npm ERR! [email protected] serve: `lite-server -c=bs-config.json` 
[1] npm ERR! Exit status 1 
[1] npm ERR! 
[1] npm ERR! Failed at the [email protected] serve script 'lite-server -c=bs-config.j                         son'. 
[1] npm 
[1] ERR! Make sure you have the latest version of node.js and npm installed. 
[1] npm ERR! If you do, this is most likely a problem with the angular-quickstart package, 
[1] npm ERR! not with npm itself. 
[1] npm ERR! Tell the author that this fails on your system: 
[1] npm 
[1] ERR!  lite-server -c=bs-config.json 
[1] npm 
[1] ERR! You can get information on how to open an issue for this project with: 
[1] npm ERR!  npm bugs angular-quickstart 
[1] npm ERR! Or if that isn't available, you can get their info via: 
[1] npm ERR!  npm owner ls angular-quickstart 
[1] npm ERR! There is likely additional logging output above. 
[1] 
[1] npm ERR! Please include the following file with any support request: 
[1] npm ERR!  C:\Users\Ahmer\My Documents\quickstart\npm-debug.log 
[1] npm run serve exited with code 1 
+0

所以,我讓它運行,我不能以任何理由在我的文檔文件夾或子文件夾中創建並運行快速入門。如果我在桌面或其他文件夾上創建它,那麼我沒有任何問題。那是什麼意思? –

回答

0

我不是100%確定,但我認爲lite-server應該運行的端口可能正在使用中。嘗試弄清楚端口是否不空閒,如果不是,則終止該端口或爲lite-server使用不同的端口。要在Windows中殺死一個端口,你可能想看看這個article