Ionic Native Object(…) is not a function


#1

I am trying to use Angular 6 + Ionic 4 latest beta

I am having issues with Native plugins of network and device. I am stuck with these issues and painful to go back to ionc v3. I wish I did not update it to ionic 4 beta. I guess now it is too late.

I am getting an error:

Object(…) is not a function

Object…/node_modules/@ionic-native/device/index.js

using:
@ionic-native/core”: “5.0.0-beta.14”,
@ionic-native/device”: “^4.16.0”,

Latest cordova, along with the device-plug-in.

Anyways, any update on this is appreciated.
Thanks
Kris


#2

No offense but I guess I answered this question at least ten times on the forum

First error, you are mixing the ionic-native package, they must be synced, update them all to 5-beta.14 or more recent

then don’t forget to change your imports to import... /ngx


#3

Thank you for the response, when I tried to use I am having issues where font color is blur and cannot read the content. I am forced to use stick to 4.0.0-beta-11 for ionic/angular.

@ionic/angular”: “4.0.0-beta.14”,
All the other are latest, as far as I know.

But I will look into them and will make sure they are. Good suggestion.

And for the device plugin there is no /NGX in the import, did you try this?

I did read the other forum posts and tried a lot before approaching you guys. My intent is not waste your time repeating the same answers, but unfortunately the recommended suggestions do not work or very generic and not addressing the concern.

Appreciate your help on this.

Thanks
Kris


#4

Please, do a quick search before creating a new post.


#5

I think you are mixing the version

@ionic/angular 

= ionic the framework with angular which is now in v4.beta-13

@ionic-native/...

= wrapper for the cordova plugins which are now in v5-beta.21 (or more)

the error you are facing should be solved as I described above

  1. sync all @ionic-native/.... versions
  2. import with /ngx like import {SplashScreen} from '@ionic-native/splash-screen/ngx';

#6

Thank you, I will try these combinations and will let you know.

Appreciate your quick response on this.


#7

I have reinstalled node modules, just in case.

Now, the device is returning null for all the properties, but I can take it from here. It is not blocking with JS errors any more.

@ionic-native/* worked fine with ^5.0.0-beta.21

but @ionic/angular, I need to force it to use 4.0.0.-beta.11 for it to work.
Beta.13 is giving me white screen (background is visible, but foreground/font are shown in white).

Thanks for your help
Kris