Ionic-native: UserAgent plugin_not_installed

Created on 23 Jan 2018  Â·  6Comments  Â·  Source: ionic-team/ionic-native

I'm submitting a ... (check one with "x")
[ x ] bug report
[ ] feature request

[17:33:56]  console.warn: Native: tried calling UserAgent.set, but the UserAgent plugin is not installed. 
[17:33:56]  console.warn: Install the UserAgent plugin: 'ionic cordova plugin add cordova-plugin-useragent' 
[17:33:56]  console.error: plugin_not_installed 

Installed ionic cordova plugin add cordova-plugin-useragent. I am running userAgent.set after platform ready, tried to reinstall everything and install it back. Any suggestions?

package.json
"im.ltdev.cordova.UserAgent": "https://github.com/LouisT/cordova-useragent"

config.xml
<plugin name="im.ltdev.cordova.UserAgent" spec="https://github.com/LouisT/cordova-useragent" />

bug

All 6 comments

Had Similar problem with ionic cordova plugin add cordova-plugin-file
So i installed the older version ionic cordova plugin add [email protected]
Now it works.

@amyogiji There is only 1 version of it. No releases on this plugin

I dont know how long I spent on this problem, but i finally figured it out.
The pluginRef in the ionic-native is set wrong.

The cordova plugin has the "clobbers target" set to "UserAgent", however the ionic-native plugin's node_modules/@ionic-native/user-agent/index.js has the pluginRef set to "plugins.useragent". They should match.

Not sure where the difference/discrepancy happened but it did, and the fix is to change the node_modules/@ionic-native/user-agent/index.js of the ionic-native user-agent plugin's pluginRef to "UserAgent". (dont forget to remove, re-add the ios/android platform for the change to get picked up)
Alternatively change the plugin's clobbers target to plugins.useragent, i found the former easier.

I dont have the time/knowledge to submit a patch to Ionic's repo, but thats the fix you can do locally.

still an issue...

I'm facing a similar issue:

Discovered plugin "im.ltdev.cordova.UserAgent" in config.xml. Adding it to the project
Failed to restore plugin "im.ltdev.cordova.UserAgent" from config.xml. 

image

I tried following the instructions from @codewise-nicolas but the pluginref was already set to useragent:
image

From the screenshot it looks like somewhere in your files it is still
referring to the wrong plugin.

Notice its trying to grab im.ltdev...

On Sun, Feb 17, 2019, 12:08 PM Nicolas Scozzaro <[email protected]
wrote:

I'm facing a similar issue:

Failed to restore plugin "im.ltdev.cordova.UserAgent" from config.xml. ```
image

I tried following the instructions from @codewise-nicolas but the pluginref was already set to useragent:
image

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ionic-team/ionic-native/issues/2287#issuecomment-464502632,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AE-bCHMQPnij9ksfKZ1T8pp23LqFy7nyks5vObbagaJpZM4RqBgo
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ihadeed picture ihadeed  Â·  4Comments

mateo666 picture mateo666  Â·  3Comments

kyleap picture kyleap  Â·  4Comments

Manduro picture Manduro  Â·  3Comments

GunaSekhar1 picture GunaSekhar1  Â·  4Comments