Ionic-Native/Httpd plugin "the Httpd plugin is not installed"

Has anyone been able to get the Httpd plugin to work with Ionic v4? I’ve tried to add it into my project in various ways and when I fire up either an iOS or Android device for testing, I get the following console messages whenever it tries to start the Httpd Web server service:

Native: tried calling Httpd.startServer, but the Httpd plugin is not installed.
[ng] [console.warn]: Install the Httpd plugin: ‘ionic cordova plugin add cordova-plugin-httpd’

That plugin is installed. I’ve done the following:

npm install @ionic-native/httpd@latest --save
ionic cordova plugin add cordova-plugin-http --save

I even created a fresh project using Ionic Studio and used Ionic Studio to add iOS and Android as platforms and then used the plugin manager to add the Httpd plugin. I then built the ionic project and ran ionic cap sync to synrchonize my build with my platform folders.

When I connect an Android device or load the app using iOS over Ionic DevApp, I get the error message shown above.

I’m trying to invoke the server with the sample code from the Ionic Native v4 page for the Httpd plugin:

  let options: HttpdOptions = {
      www_root: 'httpd_root', // relative path to app's www directory
      port: 80,
      localhost_only: false
  };

  this.httpd.startServer(options).subscribe((data) => {
      console.log('Server is live');
  });

My blank page for my test project loads normally and there are no other errors or warnings. It’s just that no matter what I try, I always end up with ionic telling me in the log output for devices connected a variety of ways that the cordova httpd plugin isn’t installed.

Ok, I figured this one out. It was stupid simple.

cordova-plugin-httpd / @ionic-native/httpd simply does not work in Ionic DevApp. You have to run it in an emulator or a real device.

If it still fails, make sure you have the port that the httpd server will run on set to one that’s not already in use. The default port is set to 80 and if you’re a Webdev I’m betting you have port 80 running something already.

If you’re not sure if you’re hitting a port conflict, just add an error output to your httpd.startServer() call.

It’ll look something like this:

Error Domain=NSPOSIXErrorDomain Code=48 “Address already in use” UserInfo={NSLocalizedDescription=Address already in use, NSLocalizedFailureReason=Error in bind() function