@ionic-native/xxxx/ngx always gives an error


Whenever I try to install a plugin nowadays, the import declaration is followed by an ‘/ngx’ suffix (ex.@ionic-native/onesignal/ngx) and whenever I try to use it, it always throws an
TypeError: Object(...) is not a function exception
it’s happening for every plugin I try to import.

ionic info gives:


   ionic (Ionic CLI)  : 4.5.0 (C:\Users\MEeZkAkpNmZaWcBX7UuQhvr2eHUjkqNe8Gules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0


   capacitor (Capacitor CLI) : 1.0.0-beta.17
   @capacitor/core           : 1.0.0-beta.17


   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4, browser 5.0.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 13 other plugins)


   NodeJS : v8.12.0 (D:\Windows\Programs\Node JS\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

I always install the latest plugin version according to the Docs.

my current code is :

import { OneSignal } from '@ionic-native/onesignal/ngx';
constructor(platform: Platform, statusBar: StatusBar,   public splashScreen: SplashScreen, private oneSignal: OneSignal) {
platform.ready().then(() => {
            oneSignal.startInit('x', 'y'); /* this invokes the exception (btw, I do have the 
credentials but for this example it is replaced by 'x' and 'y'*/

Hi @mrg250 :wave:

I see you’re using Ionic 3.9.2 so you can’t use Ionic Native 5, because it requires Ionic 4 and Angular 7.

The latest version compatible with Ionic 3 is @ionic-native/core@4.20.0, published a month ago. Update all the @ionic-native/* dependencies in your package.json to 4.20.0 and run npm install. That should fix all the problems.



hey man, u saved mylife ! ( not only my day :stuck_out_tongue: hh )