Search code examples
angularjsnode.jsnpm-start

Angular2 QuickStart npm start is not working on it's next day


I have tried Angular2 QuickStart. To execute this I have used npm start. On it's first try it is working fine. But on it's next day when I try to run using npm start it throws an error like this:

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 [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 verbose lifecycle [email protected]~prestart: unsafe-perm in lifecycle true
7 verbose lifecycle [email protected]~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 [email protected]~prestart: CWD: C:\wamp64\www\prakash_angular3
9 silly lifecycle [email protected]~prestart: Args: [ '/d /s /c', 'npm run build' ]
10 silly lifecycle [email protected]~prestart: Returned: code: 1  signal: null
11 info lifecycle [email protected]~prestart: Failed to exec prestart script
12 verbose stack Error: [email protected] 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 [email protected]
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 [email protected] prestart: `npm run build`
20 error Exit status 1
21 error Failed at the [email protected] 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 ]

How can I solve this?


Solution

  • Open 2 cmd windows at your QuickStart directory.

    Window #1:

    npm run build:watch
    

    then,

    Window #2:

    npm run serve
    

    It will then open in the browser and work as expected.