Runtime Error: Cannot find module "@ionic-native/status-bar"


#1

I keep getting this error when trying to serve my project. Not sure what to do to fix it.


#2

Hi @jttalking,

First of all I hope you have installed the StatusBar plugin in your application.

$ ionic plugin add cordova-plugin-statusbar
$ npm install --save @ionic-native/status-bar

could you please check in app.component.ts file that below mentioned code is added or not.

import { StatusBar } from ‘@ionic-native/status-bar’;

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
	  statusBar.styleDefault();
	} );
 }

and also check for app.module.ts for below mentioned code

import { StatusBar } from ‘@ionic-native/status-bar’;

In constructor

providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]

Hope this will solve your issue.

Feel free to mark it as a solution and you can always like the answer by clicking heart icon.


#3

As you’re using ionic 3 plus angular, probably, @ionic-native angular modules have changed to /ngx for supporting the other technologies (es2015+/typescript/etc) - you can read about it here: https://ionicframework.com/docs/native/

Just change import’s path as so:

import { StatusBar } from ‘@ionic-native/status-bar/ngx’;

And we’ll all go well. This applies to any current ionic-native module.


#4

Please Find Solution Here : https://stackoverflow.com/questions/54361396/ionic-3-error-install-native-plugin-after-ionic-4-release/54365080#54365080


#5

Or above on my answer… =)