ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
608 stars 304 forks source link

Ionic 4: Error on adding --livereload when running on Android or iOS #1502

Open EdwinRikkers opened 5 years ago

EdwinRikkers commented 5 years ago

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/ http://ionicworldwide.herokuapp.com/

Short description of the problem:

When running:

ionic cordova run android --livereload or ionic cordova run ios --livereload

gives the following error:

ng has unexpectedly closed (exit code 0).

When --livereload is removed it runs correctly

What behavior are you expecting?

Running livereload without and error

Steps to reproduce:

  1. running ionic cordova run android --livereload or ionic cordova run ios --livereload

Which @ionic/app-scripts version are you using?

@ionic/app-scripts@3.2.1

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

My ionic info:

ionic (Ionic CLI) : 4.5.0 Ionic Framework : @ionic/angular 4.0.0-beta.17 @angular-devkit/build-angular : 0.11.0 @angular-devkit/schematics : 7.1.0 @angular/cli : 7.1.0 @ionic/angular-toolkit : not installed

Cordova:

cordova (Cordova CLI) : 8.0.0 Cordova Platforms : android 7.0.0, ios 4.5.5 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.0.3, (and 15 other plugins)

System:

Android SDK Tools : 26.1.1 ios-deploy : 2.0.0 NodeJS : v8.11.3 npm : 6.5.0 OS : macOS High Sierra Xcode : Xcode 10.1 Build version 10B61

omkarachary commented 5 years ago

Even Im facing the same issue with Ionic 4

Ionic:

ionic (Ionic CLI) : 4.6.0 Ionic Framework : @ionic/angular 4.0.0-beta.7 @angular-devkit/build-angular : 0.7.5 @angular-devkit/schematics : 0.7.5 @angular/cli : 6.1.5 @ionic/angular-toolkit : not installed

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) Cordova Platforms : android 7.1.4 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 7 other plugins)

System:

NodeJS : v10.7.0 (C:\Program Files\nodejs\node.exe) npm : 5.3.0 OS : Windows 10

giacomocerquone commented 5 years ago

same here:

Ionic:

   ionic (Ionic CLI)             : 4.8.0 (C:\Users\Giacomo\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0-rc.2
   @angular-devkit/build-angular : 0.7.5
   @angular-devkit/schematics    : 0.7.5
   @angular/cli                  : 7.2.2
   @ionic/angular-toolkit        : not installed

Cordova:

   cordova (Cordova CLI) : not installed
   Cordova Platforms     : android 7.1.1, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.4, (and 12 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\Giacomo\AppData\Local\Android\sdk)
   NodeJS            : v10.14.1 (C:\Program Files\nodejs\node.exe)
   npm               : 6.5.0
   OS                : Windows 10
giacomocerquone commented 5 years ago

Here the command with --verbose option. This is pretty blocking, don't know how to develop on real device honestly

 ionic cordova run android --verbose --livereload
  ionic:lib Terminal info: { tty: true, ci: false, windows: true } +0ms
  ionic:lib CLI global options: { _: [ 'cordova', 'run', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, livereload: true, project: null, '--': [] } +4ms
  ionic:lib:project Project type from config: @ionic/angular (angular) +0ms
  ionic:lib:project Project details: { configPath: 'C:\\Users\\Giacomo\\Documents\\RepoLavoro\\Trapella\\atlas\\ionic.config.json', errors: [], context: 'app', type: 'angular' } +0ms
  ionic Context: { binPath: 'C:\\Users\\Giacomo\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\Giacomo\\AppData\\Roaming\\npm\\node_modules\\ionic', execPath: 'C:\\Users\\Giacomo\\Documents\\RepoLavoro\\Trapella\\atlas', version: '4.8.0' } +0ms
√ Creating .\www directory for you - done!
  ionic:lib:integrations:cordova:config Using config.xml: C:\Users\Giacomo\Documents\RepoLavoro\Trapella\atlas\config.xml +0ms
  ionic:lib:telemetry Sending telemetry for command: 'ionic cordova run' [ 'android',
  ionic:lib:telemetry   '--livereload',
  ionic:lib:telemetry   '--verbose',
  ionic:lib:telemetry   '--interactive',
  ionic:lib:telemetry   '--color' ] +0ms
  ionic:lib:hooks Looking for ionic:serve:before npm script. +0ms
[WARN] Multiple network interfaces detected!

       You will be prompted to select an external-facing IP for the dev server that your device or emulator has access
       to.

       You may also use the --address option to skip this prompt.
? Please select which IP to use: 192.168.159.148 (Wi-Fi 2)
  ionic:utils-network checking for open port on 0.0.0.0:8100 +0ms
  ionic:utils-network checking for open port on fe80::8dc:3d42:eff3:4f6a:8100 +10ms
  ionic:utils-network checking for open port on 192.168.56.1:8100 +1ms
  ionic:utils-network checking for open port on fe80::e4ff:a5d8:d1ab:43b7:8100 +1ms
  ionic:utils-network checking for open port on 192.168.70.2:8100 +1ms
  ionic:utils-network checking for open port on fe80::f803:b610:a8c6:f05:8100 +1ms
  ionic:utils-network checking for open port on 192.168.159.148:8100 +2ms
  ionic:utils-network checking for open port on ::1:8100 +1ms
  ionic:utils-network checking for open port on 127.0.0.1:8100 +1ms
  ionic:lib:serve Looking for ionic:serve npm script. +0ms
> ng run app:ionic-cordova-serve --host=0.0.0.0 --port=8100 --platform=android
[ng] Wed, 23 Jan 2019 13:07:18 GMT portfinder:defaultHosts exports._defaultHosts is: [ '0.0.0.0', 'fe80::8dc:3d42:eff3:4f6a', '192.168.56.1', 'fe80::e4ff:a5d8:d1ab:43b7', '192.168.70.2', 'fe80::f803:b610:a8c6:f05', '192.168.159.148', '::1', '127.0.0.1', null ]
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback: host is 0.0.0.0
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort entered testPort(): trying 0.0.0.0 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort done w/ testPort(): OK 0.0.0.0 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback testPort() callback with a success for port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback: host is fe80::8dc:3d42:eff3:4f6a
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort entered testPort(): trying fe80::8dc:3d42:eff3:4f6a port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort done w/ testPort(): OK fe80::8dc:3d42:eff3:4f6a port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback testPort() callback with a success for port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback: host is 192.168.56.1
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort entered testPort(): trying 192.168.56.1 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort done w/ testPort(): OK 192.168.56.1 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback testPort() callback with a success for port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback: host is fe80::e4ff:a5d8:d1ab:43b7
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort entered testPort(): trying fe80::e4ff:a5d8:d1ab:43b7 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort done w/ testPort(): OK fe80::e4ff:a5d8:d1ab:43b7 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback testPort() callback with a success for port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback: host is 192.168.70.2
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort entered testPort(): trying 192.168.70.2 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort done w/ testPort(): OK 192.168.70.2 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback testPort() callback with a success for port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback: host is fe80::f803:b610:a8c6:f05
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort entered testPort(): trying fe80::f803:b610:a8c6:f05 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort done w/ testPort(): OK fe80::f803:b610:a8c6:f05 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback testPort() callback with a success for port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback: host is 192.168.159.148
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort entered testPort(): trying 192.168.159.148 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort done w/ testPort(): OK 192.168.159.148 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback testPort() callback with a success for port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback: host is ::1
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort entered testPort(): trying ::1 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort done w/ testPort(): OK ::1 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback testPort() callback with a success for port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback: host is 127.0.0.1
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort entered testPort(): trying 127.0.0.1 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort done w/ testPort(): OK 127.0.0.1 port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback testPort() callback with a success for port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback: host is null
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort entered testPort(): trying null port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:testPort done w/ testPort(): OK null port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() iteration callback testPort() callback with a success for port 8100
[ng] Wed, 23 Jan 2019 13:07:20 GMT portfinder:getPort in eachSeries() result callback: openPorts is [ 8100, 8100, 8100, 8100, 8100, 8100, 8100, 8100, 8100, 8100 ]
  ionic:lib:serve received unexpected close for ng (code: 0) +4s

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

        The Ionic CLI will exit. Please check any output above for error details.
  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 15544: { Error: Command failed: taskkill /pid 15544 /T /F
  ionic:cli-framework:utils:process ERRORE: processo "15544" non trovato.
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:289:12)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:182:13)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:962:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:251: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 15544 /T /F' } +111ms
  ionic:cli-framework:utils:process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 15544 /T /F
  ionic:cli-framework:utils:process ERRORE: processo "15544" non trovato.
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:289:12)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:182:13)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:962:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:251: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 15544 /T /F' } +3ms
  ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 1) +1ms
giacomocerquone commented 5 years ago

Here https://forum.ionicframework.com/t/ionic-4-livereload-error-ng-has-unexpectedly-closed/153019/3 I wrote a solution that worked for me. Enjoy :)

FlorinAlexandru commented 5 years ago

Same here:

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (C:\Users\Florin\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.2.0
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.3.8
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms     : android 7.1.2
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 5 other plugins)

System:

   Android SDK Tools : 26.1.1 (E:\Soft\Android\Sdk)
   NodeJS            : v8.11.3 (E:\Soft\NodeJs\node.exe)
   npm               : 6.4.1
   OS                : Windows 10
agroves333 commented 5 years ago

Also unable to run on device with live reload:

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.4.0
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.2.4
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms     : ios 5.0.1
   Cordova Plugins       : cordova-plugin-ionic 5.3.0, cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 12 other plugins)

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.1
   NodeJS     : v11.6.0 (/usr/local/bin/node)
   npm        : 6.5.0-next.0
   OS         : macOS Mojave
   Xcode      : Xcode 10.2.1 Build version 10E1001