Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
7.0.2
-
None
-
None
-
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