I’m using cordova-plugin-webserver to start a local server.
I’ve run:
ionic cordova plugin add cordova-plugin-webserver
npm install @ionic-native/web-server
to install and included it in app.module.ts:
import {NetworkInterface} from '@ionic-native/network-interface/ngx';
@NgModule({
providers: [
WebServer,
...
})
When running on an iOS simulator or iOS real device, it reports error message as:
WARN: Native: tried calling WebServer.onRequest, but the WebServer plugin is not installed.
WARN: Install the WebServer plugin: 'ionic cordova plugin add cordova-plugin-webserver'
ERROR: plugin_not_installed
I tried to start server in the callback of this.platform.ready().then() or document.addEventListener('deviceready', () => {}) but it didn’t work.
I tried to remove iOS platform and re-add:
ionic cordova platform remove ios
ionic cordova platform add ios
It seems that someone else have the same problem on Android, which is reported in https://github.com/bykof/cordova-plugin-webserver/issues/34. But the author didn’t respond for a long time.
Not sure if this is a problem with this plugin or a general problem with ionic. Could anyone suggest how I can deal with this problem? That would be a great help. Thanks in advance.