cordova-plugin-code-push icon indicating copy to clipboard operation
cordova-plugin-code-push copied to clipboard

Error when installing plugin in project with multiple platforms

Open dymo opened this issue 9 years ago • 3 comments

Description

Adding the plugin to a project with a single platform works, but it fails if there are multiple platforms.

It is probably related to #243, maybe plugman have a problem with the beta tag?

Reproduction

If I create a project with one platform like this, then it works fine:

cordova create myapp
cd myapp
cordova platform add android
cordova plugin add cordova-plugin-code-push@latest

but if I replace:

cordova platform add android

with:

cordova platform add android ios

then I get this error when adding the plugin:

Failed to install 'cordova-plugin-code-push': CordovaError: Version of installed plugin: "[email protected]" does not satisfy dependency plugin requirement "code-push@>=1.9.0-beta".

Additional Information

Windows 10 Pro node 6.11 npm 5.0.3 cordova 7.0.1

dymo avatar Jun 19 '17 05:06 dymo

I've got the same issue, removed ios but that didn't seem to fix the issue.

Your system information:

Cordova CLI: 7.0.1 Ionic Framework Version: 3.0.1 Ionic CLI Version: 2.2.2 Ionic App Lib Version: 2.2.1 Ionic App Scripts Version: 1.3.0 ios-deploy version: Not installed ios-sim version: Not installed OS: Windows 10 Node Version: v7.9.0 Xcode version: Not installed

I resolved this by running the following:

cordova plugin add cordova-plugin-file cordova plugin add cordova-plugin-file-transfer cordova plugin add cordova-plugin-device cordova plugin add cordova-plugin-code-push@latest --force

Not sure if this is working but quite yet. Still testing

jdgeier avatar Jun 22 '17 14:06 jdgeier

Hi there @dymo and @jdgeier. Thank you so much for reaching us.

So basically the problem is as follows: Cordova7 has changed logic which they have used previously to installDependency method. Please compare Cordova6.5 vs Cordova7 implementation. As you can see latest implementation has additional logic with semver.satisfies check. Here it is described some special aspects on how semver deals with prerelease tags (also see this related comment about it). So at the end we have the following result:

>  semver.satisfies('2.0.1-beta','>=1.9.0-beta' , true)
false

At that moment I believe that @jdgeier solution should work and adding --force could help to avoid such unpleasant results.

I'm not sure if we could do something with this unless we get rid of prerelease tag or probably put an empty string instead of >=1.9.0-beta range. Please share your thoughts about this or if you see any other solutions/workarounds

max-mironov avatar Jul 03 '17 13:07 max-mironov

Hi guys, finally we decided for now to update dependency to match the exact version of code-push package. We have released new version of cordova-code-push-plugin 1.9.5-beta, you can update and verify. I'm closing the issue for now, please feel free to voice your concerns if any.

max-mironov avatar Jul 04 '17 14:07 max-mironov