HaylLtd / cordova-background-geolocation-plugin

Background and foreground geolocation plugin for Cordova.
Apache License 2.0
57 stars 66 forks source link

Failed to install 'cordova-background-geolocation-plugin': TypeError: Cannot read properties of undefined (reading 'id') #143

Closed markdegrootnl closed 1 year ago

markdegrootnl commented 1 year ago

When installing the plugin, it throws the following error:

Failed to install 'cordova-background-geolocation-plugin': TypeError: Cannot read properties of undefined (reading 'id')
    at registerConflict (/Users/mark/workspace/todn_app_2.0/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js:253:43)
    at /Users/mark/workspace/todn_app_2.0/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js:278:34
    at Array.forEach (<anonymous>)
    at PlatformMunger._is_conflicting (/Users/mark/workspace/todn_app_2.0/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js:257:21)
    at PlatformMunger.add_plugin_changes (/Users/mark/workspace/todn_app_2.0/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js:106:59)
    at /Users/mark/workspace/todn_app_2.0/node_modules/cordova-common/src/PluginManager.js:121:33
    at _fulfilled (/Users/mark/workspace/todn_app_2.0/node_modules/q/q.js:854:54)
    at /Users/mark/workspace/todn_app_2.0/node_modules/q/q.js:883:30
    at Promise.promise.promiseDispatch (/Users/mark/workspace/todn_app_2.0/node_modules/q/q.js:816:13)
    at /Users/mark/workspace/todn_app_2.0/node_modules/q/q.js:877:14
TypeError: Cannot read properties of undefined (reading 'id')
    at registerConflict (/Users/mark/workspace/todn_app_2.0/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js:253:43)
    at /Users/mark/workspace/todn_app_2.0/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js:278:34
    at Array.forEach (<anonymous>)
    at PlatformMunger._is_conflicting (/Users/mark/workspace/todn_app_2.0/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js:257:21)
    at PlatformMunger.add_plugin_changes (/Users/mark/workspace/todn_app_2.0/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js:106:59)
    at /Users/mark/workspace/todn_app_2.0/node_modules/cordova-common/src/PluginManager.js:121:33
    at _fulfilled (/Users/mark/workspace/todn_app_2.0/node_modules/q/q.js:854:54)
    at /Users/mark/workspace/todn_app_2.0/node_modules/q/q.js:883:30
    at Promise.promise.promiseDispatch (/Users/mark/workspace/todn_app_2.0/node_modules/q/q.js:816:13)
    at /Users/mark/workspace/todn_app_2.0/node_modules/q/q.js:877:14
Cannot read properties of undefined (reading 'id')

Cordova Packages:

cli: 11.0.0
    common: 4.0.2
    create: 4.0.0
    lib: 11.0.0
        common: 4.0.2
        fetch: 3.0.1
        serve: 4.0.0

Project Installed Platforms:

android: 10.1.2
ios: 6.2.0
HarelM commented 1 year ago

I have no clue what can cause this. I'm installing this plugin in a CI environment almost every day without any issues... You'll need to better check if there's something off with your env...

jdupuis commented 1 year ago

Hi @HarelM ! I think the issue comes from the plugin.xml file : the blank line before the tag can be a problem. I hope this will help you. Regards,

jdupuis commented 1 year ago

I confirm my previous hypothesis. I add the plugin to my project and I get the same error as @markdegrootnl . Then I remove the Cordova Android platform, I remove the blank line from the plugin.xml file, add the Android platform again and now it works.

HarelM commented 1 year ago

I have no clue what blank like you are referring to. Can you open a PR with a fix maybe?

jdupuis commented 1 year ago

Done ! :)

HarelM commented 1 year ago

2.0.9 released.

travisapple commented 3 months ago

Just saw this error in the current version. Same as above. Only way I could fix was remove android and then then add android.