Ionic Capacitor External Ip Not detected

I am trying to use the command,

ionic serve --host=

I am reeving the following error

> ng run app:serve --host= --port=8100
[ng] An unhandled exception occurred: listen EADDRNOTAVAIL: address not available
[ng] See "/tmp/ng-NjNf29/angular-errors.log" for further details.

[ERROR] ng has unexpectedly closed (exit code 127).
        The Ionic CLI will exit. Please check any output above for error details.

Here is my ionic info


   Ionic CLI                     : 6.16.1 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.3.1
   @angular-devkit/build-angular : 0.1100.4
   @angular-devkit/schematics    : 10.0.6
   @angular/cli                  : 10.0.6
   @ionic/angular-toolkit        : 2.3.3


   Capacitor CLI      : 3.0.0
   @capacitor/android : 3.0.0
   @capacitor/core    : 3.0.0
   @capacitor/ios     : not installed


   Cordova CLI       : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms : none
   Cordova Plugins   : no whitelisted plugins (0 plugins total)


   cordova-res (update available: 0.15.3) : 0.15.2
   native-run                             : 1.3.0


   NodeJS : v12.16.3 (/usr/local/bin/node)
   npm    : 6.14.4
   OS     : Linux 5.3

I don’t like this combination - you are mixing major versions of Angular things. Please try synchronizing them to all use the same major version.

EADDRNOTAVAIL basically means “I can’t bind to that address”. I can think of two reasons that would happen:

  1. The IP address is not that of the place you’re trying to run the server. Not much to do about this other than “use the right IP address instead”. Frankly, I would suggest never doing anything with raw IP addresses - this is why DNS was invented in the first place.

  2. Some other process is already sitting on that port on that host. Since the paths in your post imply a POSIX system, you probably have lsof available. It’s a great tool for figuring out which process is sitting on a given port so that you can kill it if desired.

I will do necessary changes in versions.

  1. The IP in the command is the same Ip address of wlan adapter.
  2. I tried the same, but there is no such process using the port. I changed port to different one but the same result.

I used the command,
ionic cap run android -l --external

Even this is not working, as it not listing any devices to run.

1 Like

Are you doing this in a VM? If so, can you see if the problem persists when running on bare metal? That way, you can see if the problem is specific to your VM situation or not.

I am not running in VM.