Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-8472

Exception (can't find config.xml) installing platform after plugins

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • Master
    • None
    • cordova-lib
    • None

    Description

      If you add a platform after adding a plugin, you can get an exception

      Repro steps:

      1. Create a new cordova app (e.g. 'cordova create TestApp').
      2. Add a plugin (e.g. 'cordova plugin add org.apache.cordova.camera').
      3. Add a platform (e.g. 'cordova platform add browser').

      Result:

      The following error:

      Failed to install 'org.apache.cordova.camera':Error: ENOENT, no such file or
      directory 'D:\tbarham\OneDrive\Documents\CordovaApps\TestApp\platforms\browser\config.xml'
          at Error (native)
          at Object.fs.openSync (fs.js:502:18)
          at Object.fs.readFileSync (fs.js:354:15)
          at Object.module.exports.parseElementtreeSync (D:\GIT\Cordova\cordova-lib\cordova-lib\src\util\xml-helpers.js:118:27)
          at Object.module.exports.package_name (D:\GIT\Cordova\cordova-lib\cordova-lib\src\plugman\platforms\browser.js:51:38)
          at PlatformMunger.generate_plugin_config_munge (D:\GIT\Cordova\cordova-lib\cordova-lib\src\plugman\util\config-changes.js:264:54)
          at PlatformMunger.add_plugin_changes (D:\GIT\Cordova\cordova-lib\cordova-lib\src\plugman\util\config-changes.js:184:29)
          at D:\GIT\Cordova\cordova-lib\cordova-lib\src\plugman\util\config-changes.js:315:14
          at Array.forEach (native)
          at PlatformMunger_process [as process] (D:\GIT\Cordova\cordova-lib\cordova-lib\src\plugman\util\config-changes.js:314:45)

      The problem is we are trying to install plugins for the platform before we call prepare() for the platform, so config.xml has not been created yet.

      Also note: we are currently passing junk to prepare() - because of the location of the call, the local variable platform is not defined, and instead we are passing a reference to a function platform().

      Attachments

        Activity

          People

            agrieve Andrew Grieve
            TimBarham Tim Barham
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified