How to resolve BABEL error when installing geolocation in ionic app

I’m trying to install geolocation in my ionic app using these commands:

ionic cordova plugin add cordova-plugin-geolocation
npm install @ionic-native/geolocation

Then I try to run the app on my device (ionic cordova run android), but I’m getting this error message:

Can someone please tell me how to resolve this?

1 Like

I have the same error. I found out that’s an issue with the latest release of a Babel package.

The issue came even with brand new projects.
I tried to start new projects on 2 different machines, one MacOS(ionic cli 5, ionic framework 5) and one Ubuntu(ionic cli 4, ionic framework 5) and both failed to build blank projects.

So lets wait for a fix!

2 Likes

I have the same problem, i seems a bug in the last version of babel.
i fixed following this comment workaround

  1. delete node_modules and package-lock.json
  2. add “resolutions”: { “@babel/preset-env”: “^7.8.7” }, to package.json
    a88242a182157c0aa05069068efc1041
  3. npm install npm-force-resolutions --save-dev
  4. npm install
  5. npx npm-force-resolutions
  6. npm install again
  7. then run your app(ionic cordova run android in my case)
3 Likes