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

Local plugins cannot be installed after a fresh installation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 7.0.2
    • Fix Version/s: None
    • Component/s: cordova-cli
    • Labels:
      None
    • Environment:

      It is in Cordova 8.0.0 (but the interface did not allow me to select it!)

      Description

      Local plugins fails to install after a fresh installation (from source control for example)

      Steps:

      cordova create sample

      cordova add plugin local/localplugin

      rm -rf plugins # to simulate fresh installation

      cordova platform add ios

      Failed to restore plugin "localplugin" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin file:local/localplugin via registry.

      Hints:

      The plugin does not install as cordova is confused by the "file:" prefix

      When adding the plugin, it is referenced in package.json as "localplugin": "file:local/localplugin", but in the config.xml the file: prefix has been stripped "<plugin name="localplugin" spec="local/localplugin" />"

      However, when restoring the plugin, it uses the file: prefix which is not supported by the cli as the protocol is not properly handled: the fetch() function just tries to load the plugin from the path being given, cannot find it because of the prefix, and then assume it has to be loaded from the registry, hence the error

      cf. https://github.com/apache/cordova-lib/blob/master/src/plugman/fetch.js#L86

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ogoguel Olivier Goguel
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: