0

我已经尝试过Angular2 QuickStart。为了执行这个,我使用了npm start. 第一次尝试它工作正常。但是第二天,当我尝试使用npm start它运行时,会引发如下错误:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using npm@3.10.10
3 info using node@v6.11.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle angular-quickstart@1.0.0~prestart: angular-quickstart@1.0.0
6 verbose lifecycle angular-quickstart@1.0.0~prestart: unsafe-perm in lifecycle true
7 verbose lifecycle angular-quickstart@1.0.0~prestart: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\wamp64\www\prakash_angular3\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\wamp64\bin\php\php5.6.25;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\Users\vis-2113\AppData\Roaming\npm
8 verbose lifecycle angular-quickstart@1.0.0~prestart: CWD: C:\wamp64\www\prakash_angular3
9 silly lifecycle angular-quickstart@1.0.0~prestart: Args: [ '/d /s /c', 'npm run build' ]
10 silly lifecycle angular-quickstart@1.0.0~prestart: Returned: code: 1  signal: null
11 info lifecycle angular-quickstart@1.0.0~prestart: Failed to exec prestart script
12 verbose stack Error: angular-quickstart@1.0.0 prestart: `npm run build`
12 verbose stack Exit status 1
12 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
12 verbose stack     at emitTwo (events.js:106:13)
12 verbose stack     at EventEmitter.emit (events.js:191:7)
12 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
12 verbose stack     at emitTwo (events.js:106:13)
12 verbose stack     at ChildProcess.emit (events.js:191:7)
12 verbose stack     at maybeClose (internal/child_process.js:920:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
13 verbose pkgid angular-quickstart@1.0.0
14 verbose cwd C:\wamp64\www\prakash_angular3
15 error Windows_NT 6.1.7601
16 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
17 error node v6.11.4
18 error npm  v3.10.10
19 error code ELIFECYCLE
20 error angular-quickstart@1.0.0 prestart: `npm run build`
20 error Exit status 1
21 error Failed at the angular-quickstart@1.0.0 prestart script 'npm run build'.
21 error Make sure you have the latest version of node.js and npm installed.
21 error If you do, this is most likely a problem with the angular-quickstart package,
21 error not with npm itself.
21 error Tell the author that this fails on your system:
21 error     npm run build
21 error You can get information on how to open an issue for this project with:
21 error     npm bugs angular-quickstart
21 error Or if that isn't available, you can get their info via:
21 error     npm owner ls angular-quickstart
21 error There is likely additional logging output above.
22 verbose exit [ 1, true ]

我该如何解决这个问题?

4

1 回答 1

1

在 QuickStart 目录中打开2 个 cmd 窗口。

窗口 #1:

npm run build:watch

然后,

窗口#2:

npm run serve

然后它将在浏览器中打开并按预期工作。

于 2017-10-27T06:05:46.493 回答