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.