Problem adding plugins on my Project -TS2345

Hello everyone .

I am trying to follow this tutorial :

And when I’ve added the Geolocation plugin, I imported that on my app.module.ts like this I get error : TS2345

import {Geolocation} from “@ionic-native/geolocation”;

and in my provider :

providers: [
{provide: ErrorHandler, useClass: IonicErrorHandler},

Package.json information :


The error is :

Ionic cli version is : 4.8.0

I’ve tried:

  1. downgrade you cli npm install -g ionic@4.8.0 , because I’ve had 4.9.0 first

Any idea ?

Thank you ind advance

You have to install the Cordova plugin and the Ionic Native wrapper module as well. Check that both are included in your package.json

Thank you for your reply , I’ve installed that but the problem still appears, I’ve tried to add another plugin and the problem is the same. I am not sure but this problem start when i’ve updated ionic cli , althoug I updated to the past version but the problem still appears . Any idea ?

Check this :

Since a new version of Ionic Native was just released with Ionic 4, I think you need to include a version # when installing the wrapper. Otherwise, it will pull in Ionic Native 5.

Open your package.json and see what the version #'s are for the StatusBar and SplashScreen. You can use that to install the proper version.

I was facing the same issue, because of the update of ionic 4 compatiable plugin in @ ionic-native github repo. You need to install older version using: npm install --save @ ionic-native /plugin_of_your_choice@4.20.0

Remember - dont play with the number after, go to the repo and check for versions, and install accordingly. I

I was facing the same issue, and it stopped after i followed the above mentioned solution. You can also see this:

Thank you for your reply . I’ve solved the problem with that although the ionic web page said :

To use a plugin, import and add the plugin injectable to a @NgModule. For Angular, the import path should end with /ngx.

More information on :

Be careful with documentation because we have to read documentation about ionic 3

Kind Regards