Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

npm dependencies conflict. TypeError: xml2js.Builder is not a function. #27

@alexbuijs

Description

@alexbuijs

Hi,

I ran into a problem with your custom dependency resolve mechanism in the afterPrepareHook. When it is run, it checks for the presence of dependent modules. It doesn't check for versions, however. As it happens, I have the xml2js module installed as a child dependency of another one of your plugins ;-)

> npm list xml2js
└─┬ cordova-hot-code-push-cli@1.0.3
  └─┬ s3-sync-aws@1.1.0
    └─┬ aws-sdk@2.2.22
      └── xml2js@0.2.8

Now, since xml2js.Builder is a function available from xml2js > 4.0, I get the following error when preparing my project:

TypeError: xml2js.Builder is not a function
  at Object.writeJsonAsXml (/builds/youngcapital/youngcapital_mobile/plugins/cordova-universal-links-plugin/hooks/lib/xmlHelper.js:46:22)
  at Object.writePreferences (/builds/youngcapital/youngcapital_mobile/plugins/cordova-universal-links-plugin/hooks/lib/android/manifestWriter.js:34:15)
  at activateUniversalLinksInAndroid (/builds/youngcapital/youngcapital_mobile/plugins/cordova-universal-links-plugin/hooks/afterPrepareHook.js:59:25)
  at /builds/youngcapital/youngcapital_mobile/plugins/cordova-universal-links-plugin/hooks/afterPrepareHook.js:39:11
  at Array.forEach (native)
  at run (/builds/youngcapital/youngcapital_mobile/plugins/cordova-universal-links-plugin/hooks/afterPrepareHook.js:35:17)
  at module.exports (/builds/youngcapital/youngcapital_mobile/plugins/cordova-universal-links-plugin/hooks/afterPrepareHook.js:18:3)

My solution for this problem was to add the latest version of xml2js to my projects package.json, so the latest version is available for the plugin. But perhaps it is possible you could prepackage the dependencies inside the plugin, instead of reinventing npm? :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions