longzheng / mypal-ionic

Mobile app to see Myki account details for iOS & Android
MIT License
68 stars 13 forks source link

ionic cordova prepare: failed to restore plugins cordova-plugin-googlemaps and cordova-plugin-statusbar #67

Closed Lx closed 7 years ago

Lx commented 7 years ago
$ ionic cordova prepare
> cordova prepare
Discovered plugin "cordova-plugin-googlemaps" in config.xml. Adding it to the project

Failed to restore plugin "cordova-plugin-googlemaps" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin git+https://github.com/mapsplugin/cordova-plugin-googlemaps.git#multiple_maps via re
gistry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Failed to get absolute path to installed module

Discovered plugin "cordova-plugin-statusbar" in config.xml. Adding it to the project
Failed to restore plugin "cordova-plugin-statusbar" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin git+https://github.com/apache/cordova-plugin-statusbar.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Failed to get absolute path to installed module
[ERROR] An error occurred while running cordova prepare (exit code 1).
$ cordova --version
7.1.0

$ ionic --version
3.17.0

$ node --version
v6.11.4

cordova-plugin-googlemaps issue #1579 suggests that this failure could be to do with the installed version of Cordova being too new, but there are conflicting reports. If this is the case, MyPal could possibly avoid being affected if it defines its dependencies more strictly.

longzheng commented 7 years ago

Hmm I've had trouble with these before, because these two plugins are pointed to a specific git branch (master is out of date).

longzheng commented 7 years ago

Should be able to update cordova-plugin-googlemaps to master now that it's been updated.

Can also update cordova-plugin-statusbar to 2.3.0 https://github.com/apache/cordova-plugin-statusbar/blob/master/RELEASENOTES.md

Lx commented 7 years ago

I resolved the issue for myself by changing package.json to just request the currently latest versions of these two plugins (according to Visual Studio Code):

diff --git a/package.json b/package.json
index e9cde7c..a4807da 100644
--- a/package.json
+++ b/package.json
@@ -41 +41 @@
-    "cordova-plugin-googlemaps": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps.git#multiple_maps",
+    "cordova-plugin-googlemaps": "^2.1.1",
@@ -48 +48 @@
-    "cordova-plugin-statusbar": "git+https://github.com/apache/cordova-plugin-statusbar.git",
+    "cordova-plugin-statusbar": "^2.2.3",

I suppose the proper fix is to determine exactly which minimum version of each plugin from the standard mechanism addresses the issues that were requiring you to pull directly from GitHub, and list those in package.json.

longzheng commented 7 years ago

@Lx unfortunately the cordova-plugin-statusbar plugin is problematic. This project needs the latest version 2.3.0 (for iPhone X fixes) which is not updated on npm for some reason, hence I need to point it directly to the git repo.

However the cordova-plugin-googlemaps plugin has been updated on npm so that's good.

longzheng commented 7 years ago

Pushed ab5044c and 53eb977 to try fix this