2

I was facing dependency errors so created a new project to test this. See steps to replicate issue below.

Environment:

  • Node: v10.14.1
  • Ionic: v4.6.0
  • npm: 6.4.1
  • Angular CLI: 7.1.2
  • Angular: 5.2.11

Steps:

  1. Run -> ionic start TestP
  2. Go to TestP folder
  3. Run -> ionic cordova plugin add cordova-plugin-firebase-analytics
  4. Run -> npm install --save @ionic-native/firebase-analytics
  5. Run -> ionic cordova platform add android
  6. Run -> ionic cordova plugin add phonegap-plugin-push

The error ("Version of installed plugin does not satisfy dependency plugin requirement") asks me to run the statement again using --force but I want to avoid this and intend to understand what is the error and solution for this.

error

variable
  • 8,262
  • 9
  • 95
  • 215

1 Answers1

1

The issue is open on github and discussed here:

https://github.com/phonegap/phonegap-plugin-push/issues/2722

The main problem is that the last update of this plugin on the NPM repo is 9 months old (as at 27th Feb 2019), so it contains old versions of the dependencies, which prevents it from installing, when there are newer versions of the dependency plugins installed. The only way I can get it to install is to roll back the dependent plugins by several versions e.g. I'm stuck with having to use firebase-analytics v11 when the latest version is v17.3.

It is also noted that this was fixed in the github repo, but never published to npm, so you can resolve by using:

cordova plugin add https://github.com/phonegap/phonegap-plugin-push.git

Jay Ordway
  • 1,708
  • 2
  • 11
  • 33
  • Hi - what do you mean by "fixed in the github repo, but never published to npm"? My knowledge suggests that 'cordova plugin add' command is for adding the plugin to the project where as the 'npm install' command is to install the wrapper for this plugin so that it can be used in the project. The last line from your reply suggests that the issue can be resolved using 'cordova plugin add URL'. What about the npm install command please? – variable Apr 10 '19 at 07:21
  • 'cordova plugin add { | } ' does add it from the npm registry, this is noted in the docs: https://cordova.apache.org/docs/en/latest/reference/cordova-cli/ The command I listed is to install it from github directory as opposed to npm. If the bug was fixed in cordova project itself, the ionic native wrapper should be fine, I could not say for sure without investigating, I doubt the fix in the cordova project warranted any breaking change in the ionic native wrapper. So it should just be: npm install @ionic-native/push – Jay Ordway Apr 10 '19 at 07:50
  • Thanks. This does not resolve my issue, but I have upvoted your answer and will keep this question open until I hear more. FYI - I have also started a new question here on general installation dependency considerations - https://stackoverflow.com/questions/55606811/considerations-for-getting-around-ionic-cordova-plugin-dependency-related-errors – variable Apr 10 '19 at 07:54
  • Did you try `rm -rf node_modules plugins platforms` and then reinstalling? This should not be too bad to resolve, you just need the correct version of cordova-support-google-service, often times I have to recreate platform folders from scratch though – Jay Ordway Apr 10 '19 at 08:04