Build error due to webview dependency

Having trouble building the iOS app. We need to support iOS9. So, we made sure to use the latest version of Ionic and webview that supports that. I have it set to cordova-plugin-ionic version 4.1.7 and cordova-plugin-ionic-webview to 1.1.19. But, despite that, the ionic pro build(or when I delete the plugin and platforms folder and do a cordova prepare) fails with a dependency error “Failed to install ‘cordova-plugin-ionic’: CordovaError: Version of installed plugin: “cordova-plugin-ionic-webview@1.2.1” does not satisfy dependency plugin requirement “cordova-plugin-ionic-webview@>=2.0.0”. Try --force to use installed plugin as dependency.” I’m not sure why as I don’t see any depedency in the source for 4.1.7 for webview 2 until version 5.

Here’s the relevant part for confix.xml plugins:

 <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-fcm" spec="^2.1.2" />
    <plugin name="cordova-plugin-screen-orientation" spec="^3.0.1" />
    <plugin name="cordova-plugin-app-version" spec="^0.1.9" />
    <plugin name="cordova-plugin-splashscreen" spec="^5.0.1" />
    <plugin name="cordova-plugin-file-transfer" spec="^1.7.1" />
    <plugin name="cordova-plugin-badge" spec="^0.8.7" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.1.2" />
    <plugin name="cordova-plugin-camera" spec="^4.0.2" />
    <plugin name="cordova-plugin-statusbar" spec="^2.4.1" />
    <plugin name="cordova-plugin-device-name" spec="^1.3.4" />
    <plugin name="cordova-plugin-device" spec="^1.1.7" />
    <plugin name="cordova-sqlite-storage" spec="^2.3.3" />
    <plugin name="cordova-plugin-privacyscreen" spec="^0.4.0" />
    <plugin name="cordova-plugin-ionic-webview" spec="^1.1.19" />
    <plugin name="cordova-plugin-ionic" spec="^4.1.7">

And for package.json:

 "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-badge": "^0.8.7",
    "cordova-plugin-camera": "^4.0.2",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-device-name": "^1.3.4",
    "cordova-plugin-fcm": "^2.1.2",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-firebase": "^1.0.5",
    "cordova-plugin-ionic": "^4.1.7",
    "cordova-plugin-ionic-keyboard": "^2.1.2",
    "cordova-plugin-ionic-webview": "^1.1.19",
    "cordova-plugin-privacyscreen": "^0.4.0",
    "cordova-plugin-screen-orientation": "^3.0.1",
    "cordova-plugin-splashscreen": "^5.0.1",
    "cordova-plugin-statusbar": "^2.4.1",
    "cordova-plugin-whitelist": "^1.3.3"

Any ideas on what to check or how to debug the source of the dependency issue?

Can you build locally and does this problem only appear when building on Ionic Pro?

I would search all code for this string or only the package name to find out who is adding this requirement.

What is your ionic info output?

Ionic Info

[WARN] Bad integration name: gulp

Ionic:

   ionic (Ionic CLI)  : 4.0.3 (C:\Users\DSD0027\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.11

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 6.4.0, browser 5.0.3, ios 4.5.5

System:

   Android SDK Tools : 26.1.1
   NodeJS            : v8.10.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.2.0
   OS                : Windows 10

Environment:

   ANDROID_HOME : C:\Users\DSD0027\AppData\Local\Android\Sdk

If I use

ionic cordova plugin add cordova-plugin-ionic@4.1.7

it works. Or, it seems to. I’m on windows and haven’t setup our mac to build the mac version as it would take a lot of time.

I searched the code and plugins folder for

cordova-plugin-ionic-webview@>=2.0.0

and couldn’t find anything.

Do you have any output oh Pro that indicates if it maybe is using other plugin versions?

Not that I notice. Here’s the end section of the output from the last failed build.

+------+------------------------------------+-------------+
|                    fastlane summary                     |
+------+------------------------------------+-------------+
| Step | Action                             | Time (in s) |
+------+------------------------------------+-------------+
| 1    | default_platform                   | 0           |
| 2    | build_summary                      | 5           |
| 3    | create_keychain                    | 0           |
| 4    | download_certs                     | 2           |
| 5    | import_certificate                 | 0           |
| 6    | build_pro_app                      | 71          |
| 💥   | cordova platform add ios --nofetch | 15          |
| 8    | upload_logs                        | 0           |
| 9    | shell command                      | 0           |
| 10   | delete_keychain                    | 0           |
+------+------------------------------------+-------------+

[17:30:05]: fastlane finished with errors
[17:30:05]: Sending crash report...
[17:30:05]: The stack trace is sanitized so no personal information is sent.
[17:30:05]: To see what we are sending, look here: /Users/ionic/.fastlane/latest_crash.json
[17:30:05]: Learn more at https://github.com/fastlane/fastlane#crash-reporting
[17:30:05]: You can disable crash reporting by adding `opt_out_crash_reporting` at the top of your Fastfile

Looking for related GitHub issues on fastlane/fastlane...

\e[91mFailed to upload ipa to storage please retry your build.\e[0m
MAC Iteration 1
MAC verified OK
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 2048
Certificate bag
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2048
/Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane_core/lib/fastlane_core/ui/interface.rb:145:in `shell_error!': [!] Exit status of command 'cordova platform add ios --nofetch' was 1 instead of 0. (FastlaneCore::Interface::FastlaneShellError)
Adding ios project...
Creating Cordova project for the iOS platform:
	Path: platforms/ios
	Package: com.mycare.aegistherapies.app
	Name: myCare
iOS project created with cordova-ios@4.5.5
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-whitelist@^1.3.3" via npm
Installing "cordova-plugin-whitelist" for ios
Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
Discovered plugin "cordova-plugin-fcm" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-fcm@^2.1.2" via npm
Installing "cordova-plugin-fcm" for ios

		Cordova FCM plugin v2.1.2 installed
		For more details visit https://github.com/fechanique/cordova-plugin-fcm
	
Adding cordova-plugin-fcm to package.json
Saved plugin info for "cordova-plugin-fcm" to config.xml
Discovered plugin "cordova-plugin-screen-orientation" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-screen-orientation@^3.0.1" via npm
Installing "cordova-plugin-screen-orientation" for ios
Adding cordova-plugin-screen-orientation to package.json
Saved plugin info for "cordova-plugin-screen-orientation" to config.xml
Discovered plugin "cordova-plugin-app-version" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-app-version@^0.1.9" via npm
Installing "cordova-plugin-app-version" for ios
Adding cordova-plugin-app-version to package.json
Saved plugin info for "cordova-plugin-app-version" to config.xml
Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-splashscreen@^5.0.1" via npm
Installing "cordova-plugin-splashscreen" for ios
Adding cordova-plugin-splashscreen to package.json
Saved plugin info for "cordova-plugin-splashscreen" to config.xml
Discovered plugin "cordova-plugin-file-transfer" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-file-transfer@^1.7.1" via npm
Installing "cordova-plugin-file-transfer" for ios
Fetching plugin "cordova-plugin-file@>=5.0.0" via npm
Installing "cordova-plugin-file" for ios
Adding cordova-plugin-file-transfer to package.json
Saved plugin info for "cordova-plugin-file-transfer" to config.xml
Discovered plugin "cordova-plugin-badge" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-badge@^0.8.7" via npm
Installing "cordova-plugin-badge" for ios
Adding cordova-plugin-badge to package.json
Saved plugin info for "cordova-plugin-badge" to config.xml
Discovered plugin "cordova-plugin-ionic-keyboard" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-ionic-keyboard@^2.1.2" via npm
Installing "cordova-plugin-ionic-keyboard" for ios
Adding cordova-plugin-ionic-keyboard to package.json
Saved plugin info for "cordova-plugin-ionic-keyboard" to config.xml
Discovered plugin "cordova-plugin-camera" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-camera@^4.0.2" via npm
Installing "cordova-plugin-camera" for ios
Adding cordova-plugin-camera to package.json
Saved plugin info for "cordova-plugin-camera" to config.xml
Discovered plugin "cordova-plugin-statusbar" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-statusbar@^2.4.1" via npm
Installing "cordova-plugin-statusbar" for ios
Adding cordova-plugin-statusbar to package.json
Saved plugin info for "cordova-plugin-statusbar" to config.xml
Discovered plugin "cordova-plugin-device-name" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-device-name@^1.3.4" via npm
Installing "cordova-plugin-device-name" for ios
Adding cordova-plugin-device-name to package.json
Saved plugin info for "cordova-plugin-device-name" to config.xml
Discovered plugin "cordova-plugin-device" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-device@^1.1.7" via npm
Installing "cordova-plugin-device" for ios
Adding cordova-plugin-device to package.json
Saved plugin info for "cordova-plugin-device" to config.xml
Discovered plugin "cordova-sqlite-storage" in config.xml. Adding it to the project
Fetching plugin "cordova-sqlite-storage@^2.3.3" via npm
Installing "cordova-sqlite-storage" for ios
installing external dependencies via npm
npm install of external dependencies ok
Adding cordova-sqlite-storage to package.json
Saved plugin info for "cordova-sqlite-storage" to config.xml
Discovered plugin "cordova-plugin-privacyscreen" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-privacyscreen@^0.4.0" via npm
Installing "cordova-plugin-privacyscreen" for ios
Adding cordova-plugin-privacyscreen to package.json
Saved plugin info for "cordova-plugin-privacyscreen" to config.xml
Discovered plugin "cordova-plugin-ionic-webview" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-ionic-webview@^1.1.19" via npm
Installing "cordova-plugin-ionic-webview" for ios
Adding cordova-plugin-ionic-webview to package.json
Saved plugin info for "cordova-plugin-ionic-webview" to config.xml
Discovered plugin "cordova-plugin-ionic" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-ionic@^4.1.7" via npm
Installing "cordova-plugin-ionic" for ios
Plugin dependency "cordova-plugin-splashscreen@5.0.2" already fetched, using that version.
Dependent plugin "cordova-plugin-splashscreen" already installed on ios.
Failed to install 'cordova-plugin-ionic': CordovaError: Version of installed plugin: "cordova-plugin-ionic-webview@1.2.1" does not satisfy dependency plugin requirement "cordova-plugin-ionic-webview@>=2.0.0". Try --force to use installed plugin as dependency.
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:557:37
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:509:49
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
Failed to restore plugin "cordova-plugin-ionic" from config.xml. You might need to try adding it again. Error: Version of installed plugin: "cordova-plugin-ionic-webview@1.2.1" does not satisfy dependency plugin requirement "cordova-plugin-ionic-webview@>=2.0.0". Try --force to use installed plugin as dependency.
--save flag or autosave detected
Saving ios@~4.5.5 into config.xml file ...

	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane_core/lib/fastlane_core/ui/ui.rb:16:in `method_missing'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/helper/sh_helper.rb:80:in `sh_control_output'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/helper/sh_helper.rb:16:in `sh_no_action'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/fast_file.rb:186:in `block in sh'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/fast_file.rb:185:in `sh'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/fast_file.rb:180:in `sh'
	from Fastfile:27:in `block (2 levels) in parsing_binding'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/lane.rb:33:in `call'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/lane.rb:33:in `call'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/runner.rb:45:in `chdir'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/runner.rb:45:in `execute'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/lane_manager.rb:56:in `cruise_lane'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/command_line_handler.rb:34:in `handle'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/commands_generator.rb:107:in `block (2 levels) in run'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/commander-fastlane-4.4.5/lib/commander/command.rb:178:in `call'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/commander-fastlane-4.4.5/lib/commander/command.rb:178:in `call'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/commander-fastlane-4.4.5/lib/commander/command.rb:153:in `run'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/commander-fastlane-4.4.5/lib/commander/runner.rb:476:in `run_active_command'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:75:in `run!'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/commander-fastlane-4.4.5/lib/commander/delegates.rb:15:in `run!'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/commands_generator.rb:336:in `run'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/commands_generator.rb:42:in `start'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane/lib/fastlane/cli_tools_distributor.rb:94:in `take_off'
	from /Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/bin/fastlane:20:in `'
	from /Users/ionic/.fastlane/bin/bundle/bin/fastlane:22:in `load'
	from /Users/ionic/.fastlane/bin/bundle/bin/fastlane:22:in `
'
Running after script...
$ clean-up
Cleaning up files...

This seems to be where it is going wrong, right?

The dependency was only added a few days ago for 5.x:
https://github.com/ionic-team/cordova-plugin-ionic/blame/64be7acf92dcfd2e0dcafe5c9e7f2bf4b08a9ecd/plugin.xml#L88

4.1.7 only has a dep to splashscreen:

Why does is suddenly have and parse the plugin.xml of cordova-plugin-ionic 5.x?

If you create a new project with ionic start, add the same platform and plugins you are using and put it on Github I can try to build on a Mac directly.

Thanks. I’ll look into the splashscreen on Monday. That might be the key. If not, I’ll do the new project thing.

This to me seems like a total red herring - from what is output the plugin is doing exactly what it should do.

What you could try is to change the dependency of the webview plugin to something >=2.0.0 which it wants to have and see if everything succeeds then.

PS: I created an issue with Cordova that could help debug this in the future: https://issues.apache.org/jira/projects/CB/issues/CB-14253

I created a new project and it did exactly the same thing. You can find it here https://github.com/sdancer/DebugIonic. Also, it does appear that moving webview to 2.0.2 makes cordova prepare work. I was using this https://ionic.zendesk.com/hc/en-us/articles/360007385413-2018-07-23-Ionic-Pro-Deploy-v5-released as a reference on what veresions I need to support iOS 9.

1 Like

Ok. It’s solved. Turns out that cordova-plugin-ionic 4.2 was being installed because of the ^. I switched to ~ and it stayed at 4.1.7 and it works now.

2 Likes

Huh!? Shouldn’t ^4.1.7 only allow 4.1.x version to be installed?

Oh, I was wrong:
https://docs.npmjs.com/misc/semver#caret-ranges-123-025-004
https://docs.npmjs.com/misc/semver#tilde-ranges-123-12-1

But: Confirms that the JIRA issue I created really is necessary to tell users what version is actually installed.
And: We should have checked ionic cordoca plugins list @dsdancer to confirm the plugin version that was installed.

Plugins list didn’t list it because it failed to install due to the dependency issue.

Damn, you are right. So the only place to really notice this would have been the output from Cordova.