Ionic 4: Livereload: [Error] ng has unexpectedly closed

#1

$ionic cordova emulate ios -l -c --target=“iPhone-6s” – --buildflag="-UseModernBuildSystem=0"

> ng run app:ionic-cordova-serve --host=0.0.0.0 --port=8100 --platform=ios

[ERROR] ng has unexpectedly closed (exit code 0).

        The Ionic CLI will exit. Please check any output above for error details.

Running the exact command without -l works fine. This started happening after upgrading from beta13 to rc1.

Verbose output

  ionic:cli-framework:utils:process onBeforeExit handler: process.exit received +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: running 1 functions +1ms
  ionic:cli-framework:utils:process error while killing process tree for 8380: { Error: Command failed: taskkill /pid 8380 /T /F
  ionic:cli-framework:utils:process ERROR: The process "8380" not found.
  ionic:cli-framework:utils:process 
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:294:12)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:188:13)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:978:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 8380 /T /F' } +116ms
  ionic:cli-framework:utils:process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 8380 /T /F
  ionic:cli-framework:utils:process ERROR: The process "8380" not found.
  ionic:cli-framework:utils:process 
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:294:12)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:188:13)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:978:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 8380 /T /F' } +3ms
  ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 1) +2ms

Any ideas?

#2

Fixed this by generating a new project and copy pasting everything over. Mostly looks the same so not sure what the problem was.

#3

Same problem, same solution, but I can tell you more.
Originally I didi as @jentevh said copying all the files, but the project still wasn’t working so I made some tests and discovered that the file that was giving me troubles was angular.json, replacing that, everything worked fine!