Ionic-native: @ionic-native/network plugin not working

Created on 27 Apr 2017  路  8Comments  路  Source: ionic-team/ionic-native

Module '"C:/Users/anees/network/node_modules/@ionic-native/core/index"' has no exported member 'IonicNativePlugin'.

capture

// home.ts
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Network } from '@ionic-native/network';
@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrl: NavController, private network: Network) {
    // watch network for a disconnect
        let disconnectSubscription = this.network.onDisconnect().subscribe(() => {
          console.log('network was disconnected :-(');
        });
  }

}


also add to the providers array in app.module.ts

Most helpful comment

Make sure the version of "@ionic-native/core" and "@ionic-native/network" are the same.

See package.json

All 8 comments

Make sure the version of "@ionic-native/core" and "@ionic-native/network" are the same.

See package.json

+1
The same version:

"@ionic-native/core": "3.5.0",
"@ionic-native/network": "3.5.0",

Ah it works. Thanks @adairborba @aceoliver

how do you resolved it?

@nicoisz install @ionic-native/core@latest

@nicoisz and @aneeskodappana i had to uninstall first before it works:
npm uninstall --save @ionic-native/core
then
npm install --save @ionic-native/core@latest

@brouviere

I did the process of uninstalling and installing --save.

Now I'm getting this error:

C:\nodejs\apps\corretorOK>npm install --save @latest
npm ERR! addLocal Could not install C:\nodejs\apps\corretorOK\@latest
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\nodejs\node.exe" "C:\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--save" "@latest"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! path C:\nodejs\apps\corretorOK\@latest
npm ERR! code ENOENT
npm ERR! errno -4058

npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'C:\nodejs\apps\corretorOK\@latest'
npm ERR! enoent ENOENT: no such file or directory, open 'C:\nodejs\apps\corretorOK\@latest'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR! C:\nodejs\apps\corretorOK\npm-debug.log

@PedroDiniz you need to add the package name to the command. Not just npm install --save by itself.

I believe they were suggesting that you run
npm i --save @ionic-native/network@latest @ionic-native/network@latest

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jgw96 picture jgw96  路  3Comments

rajanshahsa picture rajanshahsa  路  3Comments

mateo666 picture mateo666  路  3Comments

goleary picture goleary  路  3Comments

ihadeed picture ihadeed  路  4Comments