Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Some plugins fetch and install dependency plugins.
These dependency plugins should be removed when the top-level depender plugin is removed.
However, this is not happening.
For example, cordova-plugin-media brings cordova-plugin-file as a dependency.
When, cordova-plugin-media is removed cordova-plugin-file should be removed together.
I figured that this is caused by resetting the top-level property of plugins when adding a new platform.
Here is how to reproduce the bug.
[test] cordova create test Creating a new cordova project. [test] cd test [test] cordova plugin add cordova-plugin-media Fetching plugin "cordova-plugin-media@~2.1.0" via npm [test] cordova platform add ios Adding ios project... iOS project created with cordova-ios@4.0.1 Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project Fetching plugin "cordova-plugin-whitelist@1" via npm Installing "cordova-plugin-whitelist" for ios Installing "cordova-plugin-media" for ios Fetching plugin "cordova-plugin-file" via npm Installing "cordova-plugin-file" for ios [test] cordova plugin cordova-plugin-file 4.1.1 "File" cordova-plugin-media 2.1.0 "Media" cordova-plugin-whitelist 1.2.1 "Whitelist" [test] cordova platform add android Adding android project... Creating Cordova project for the Android platform: Path: platforms/android Package: io.cordova.hellocordova Name: HelloCordova Activity: MainActivity Android target: android-23 Android project created with cordova-android@5.1.0 Installing "cordova-plugin-file" for android Installing "cordova-plugin-media" for android Dependent plugin "cordova-plugin-file" already installed on android. Installing "cordova-plugin-whitelist" for android This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in. [test] cordova plugin rm cordova-plugin-media Uninstalling cordova-plugin-media from android Uninstalling 1 dependent plugins. Uninstalling cordova-plugin-file from ios Uninstalling cordova-plugin-media from ios Removing "cordova-plugin-media" [test] cordova plugin cordova-plugin-file 4.1.1 "File" cordova-plugin-whitelist 1.2.1 "Whitelist"
If you see the following error when adding the ios platform, I already fixed that issue in CB-10659.
Failed to install 'cordova-plugin-whitelist':Error: ENOENT, no such file or directory '/Users/bso/cordova/test/temp/platforms/ios/HelloCordova.xcodeproj/project.pbxproj'
You don't need to use ios to reproduce this issue. Use windows instead if you can't add ios.