Uncaught Error: Cannot find module "@ionic-native/network"


#1

I am getting this error in my service

Cannot find name 'Network'.

I have installed the ionic plugin add cordova-plugin-network-information

and here is my service

import { Network } from '@ionic-native/network';

@Injectable()
export class DataService {
     constructor(private network: Network) { }
}


#2

You need to install the npm package too:

npm install @ionic-native/network --save


#3

thanks @joshmorony this fixes Cannot find name 'Network' but I am still getting this Uncaught Error: Cannot find module "@ionic-native/core"

I just wanted to check network status before making any HTTP request, any other way doing this, currently I am adding this check in my HTTP wrapper DataService.


#4

You also need to import into your app.module.ts file and add it as a provider there.


#5

I ran this command and it gives me this error.
’-- UNMET PEER DEPENDENCY typescript@2.0.9


#6

try to call it after device ready event


#7

which one has been add in app.module.ts