Ionic Native Object(…) is not a function

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

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

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

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

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';

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

Appreciate your quick response on this.

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

I am having following version of dependencies:

"@ionic-native/music-controls": "^5.8.0",

and ionic info as below:

Ionic:

   Ionic CLI          : 5.1.0 (C:\Users\Kunal-Kakkad\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.9

Cordova:

   Cordova CLI       : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms : android 7.1.4, ios 4.5.5
   Cordova Plugins   : cordova-plugin-ionic-webview 1.1.1, (and 16 other plugins)

Utility:

   cordova-res : 0.5.0
   native-run  : 0.2.6

System:

   NodeJS : v11.6.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.5.0
   OS     : Windows 10

I have also made the changes of …/ngx for import statement.
But still I am facing the same error.

Any kind of help is very helpful.

Thanks
Kunal Kakkad

Hi, i have same problem i cannot use ngx library in my project… i dont know what the issue is i have latest ionic 5.4.11 this is all installed plugin. i m new in ionic and struggling in this. i need help.Thanks

@angular-devkit/build-angular”: “~0.803.20”,
@angular/cli”: “~8.3.23”,
@angular/compiler”: “~8.2.14”,
@angular/compiler-cli”: “~8.2.14”,
@angular/language-service”: “~8.2.14”,
@ionic/angular-toolkit”: “^2.1.1”,
@types/jasmine”: “~3.3.8”,
@types/jasminewd2”: “~2.0.3”,
@types/node”: “~8.9.4”,
“codelyzer”: “^5.0.0”,
“jasmine-core”: “~3.4.0”,
“jasmine-spec-reporter”: “~4.2.1”,
“karma”: “~4.1.0”,
“karma-chrome-launcher”: “~2.2.0”,
“karma-coverage-istanbul-reporter”: “~2.0.1”,
“karma-jasmine”: “~2.0.1”,
“karma-jasmine-html-reporter”: “^1.4.0”,
“protractor”: “~5.4.0”,
“ts-node”: “~7.0.0”,
“tslint”: “~5.15.0”,
“typescript”: “~3.4.3”

if i downgrade the geolocation plugin version i’m getting errror.
Uncaught TypeError: Object(…) is not a function
at index.js:159
at Module…/node_modules/@ionic-native/geolocation/index.js

That’s not the relevant part of package.json for anybody to help you. dependencies are needed, not devDependencies.

Dependencies is
ionic version-5.4.11
cordova - 8.0.0
Node - v12.13.1
Npm - 6.12.1

Never mind. Just post the entirety of package.json.