Runtime Error Cannot find module "@ionic-native"


#1

I got the error . Runtime Error Cannot find module “@ionic-native when I ran command: ionic serve

My app.module.ts file is

import { NgModule, ErrorHandler } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { ReportPage } from '../pages/report/report';
import { StatusPage } from '../pages/status/status';
import { RegistroPage } from '../pages/registro/registro';
import { TabsPage } from '../pages/tabs/tabs';
// Import the AF2 Module
import { AngularFireModule } from 'angularfire2';

// DB Service
import { DBService } from '../services/db.service';
// User Service
import { UserService } from '../services/user.service';

// Import StartPage
import { StartPage } from '../pages/start/start';

// Providers
import { RegisterService } from '../providers/register-service';

// Toast
import { Toast } from '@ionic-native/toast';

// AF2 Settings
export const firebaseConfig= { 
// Mis datos de conexión a Firebase
};

@NgModule({
  declarations: [
    MyApp,
    ReportPage,
    StatusPage,
    RegistroPage,
    TabsPage,
    StartPage
  ],
  imports: [
    IonicModule.forRoot(MyApp),    
    AngularFireModule.initializeApp(firebaseConfig)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    ReportPage,
    StatusPage,
    RegistroPage,
    TabsPage,
    StartPage
  ],
  providers: [{provide: ErrorHandler, useClass: IonicErrorHandler},
  DBService, Toast, UserService, RegisterService ]
})
export class AppModule {}

Anyone know How to fix that? Thanks.


#2

I would start by looking for places where you are importing things from “@ionic-native”, which doesn’t exist.


#4

cd into your project and type the following command with internet connection

npm install --save ionic-native


#5

No, don’t do this. Do what @rapropos said, you are importing stuff from “@ionic-native” somewhere.