ng serve error: start script fail

10 9 verbose lifecycle test1@0.0.0~start: CWD: /home/ubuntu/prj/test1
 11 10 silly lifecycle test1@0.0.0~start: Args: [ '-c', 'ng serve' ]
 12 11 silly lifecycle test1@0.0.0~start: Returned: code: 1 signal: null
 13 12 info lifecycle test1@0.0.0~start: Failed to exec start script
 14 13 verbose stack Error: test1@0.0.0 start: `ng serve`
 15 13 verbose stack Exit status 1
 16 13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/ lib/utils/lifecycle.js:289:16)
 17 13 verbose stack at emitTwo (events.js:125:13)
 18 13 verbose stack at EventEmitter.emit (events.js:213:7)
 19 13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/ lib/utils/spawn.js:40:14)
 20 13 verbose stack at emitTwo (events.js:125:13)
 21 13 verbose stack at ChildProcess.emit (events.js:213:7)
 22 13 verbose stack at maybeClose (internal/child_process.js:921:16)
 23 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_ process.js:211:5)

when I did ng serve this error log was printed.

The solution:

  1. remove the angular-cli in the dependencies in package.json.
  2. remove the node_modules diretory
  3. do npm install again.

After this, ng serve worked fine.

 

Advertisements