Raphaël Balet
Raphaël Balet

Reputation: 8543

Cordova error with ionic : Unable to load Platform API from... Cannot find module 'properties-parser'

I wanted to get the device model into my ionic v5 app.

I wanted to use Cordova for that purpose running the following ionic cordova plugin add cordova-plugin-device, but I did get the following error.

Installing "cordova-plugin-device" for android
Failed to install 'cordova-plugin-device': Error: Unable to load Platform API from C:\Users\my-project\platforms\android\cordova\Api.js:
Cannot find module 'properties-parser'

Did somebody already had this error and find a solution to it?

Upvotes: 1

Views: 4220

Answers (2)

shine odigie
shine odigie

Reputation: 296

First remove platform android with

sudo ionic cordova platform rm android

then add your plugin again

sudo ionic cordova plugin add cordova-plugin-advanced-http

this works for me

Upvotes: 0

Raphaël Balet
Raphaël Balet

Reputation: 8543

Ok, find a workaround.

Somehow, while trying to add the cordova-plugin-device cordova did try to use stuff inside the platforms folder.

To fix the problem, I had to remove them using ionic cordova platform rm android then I could run the command again and it worked as expected.

Upvotes: 4

Related Questions