Adding Windows platform is trying to add cordova-plugin-wkwebview-engine and causing an error

I have an existing Ionic application where I have had all of Android, iOS, and Windows platforms included. I have left out Windows for a while, but now have the need to build a Windows 10 UWP version.

I thought since I added the Windows platform a long time ago (when Ionic in Beta and on a different Windows machine), I’d first remove it and then add it back (as it didn’t build anyway).

I Now seem get an error that sees to be related to the cordova-plugin-wkwebview-engine that I added for iOS.

I have Visual Studio 2017 installed (and all the Cordova etc packages)…

Here is the error I get…

ionic cordova platform add windows --info
> cordova platform add windows --save
✖ Running command - failed!

[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova platform add windows --save (exit code 1):


        You have been opted out of telemetry. To change this, run: cordova telemetry on.
        Using cordova-fetch for cordova-windows@~5.0.0
        Adding windows project...              

			  Creating Cordova Windows Project:
        Path: platforms\windows
        Namespace: com.myapp
        Name: Mayapp
        Windows project created with cordova-windows@5.0.0
        The following image was skipped because it has an unsupported size (undefinedxundefined):
        resources\android\icon\drawable-xhdpi-icon.png
        Installing "cordova-plugin-app-version" for windows
        Installing "cordova-plugin-compat" for windows
        Installing "cordova-plugin-console" for windows
        Installing "cordova-plugin-device" for windows
        Installing "cordova-plugin-email-composer" for windows
        Installing "cordova-plugin-file" for windows
        Plugin dependency "cordova-plugin-compat@1.1.0" already fetched, using that version.
        Dependent plugin "cordova-plugin-compat" already installed on windows.
        Installing "cordova-plugin-ios-disableshaketoedit" for windows
        Installing "cordova-plugin-network-information" for windows
        Installing "cordova-plugin-splashscreen" for windows
        Installing "cordova-plugin-statusbar" for windows
        Installing "cordova-plugin-whitelist" for windows
        Installing "cordova-plugin-x-socialsharing" for windows
        Installing "cordova-plugin-x-toast" for windows
        Installing "cordova-plugin-zip" for windows
        Plugin dependency "cordova-plugin-file@4.3.1" already fetched, using that version.
        Dependent plugin "cordova-plugin-file" already installed on windows.
        Installing "cordova-sqlite-storage" for windows
        installing external dependencies via npm
        npm install of external dependencies ok
        Installing "ionic-plugin-keyboard" for windows
        Discovered plugin "cordova-plugin-wkwebview-engine" in config.xml. Adding it to the project
        Failed to restore plugin "cordova-plugin-wkwebview-engine" from config.xml. You might need to try adding it
        again. Error: Failed to fetch plugin
        cordova-plugin-wkwebview-engine@git+https://github.com/driftyco/cordova-plugin-wkwebview-engine.git via
        registry.
        Probably this is either a connection problem, or plugin spec is incorrect.
        Check your connection and plugin name/version/URL.
        Error: cmd: Command failed with exit code 1 Error output:
        npm ERR! git fetch -a origin (https://github.com/driftyco/cordova-plugin-wkwebview-engine.git) fatal: Unable to
        find remote helper for 'https'
        npm ERR! Windows_NT 10.0.15063
        npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
        Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
        "cordova-plugin-wkwebview-engine@git+https://github.com/driftyco/cordova-plugin-wkwebview-engine.git" "--save"
        npm ERR! node v6.11.0
        npm ERR! npm  v3.10.10
        npm ERR! code 128

        npm ERR! Command failed: git -c core.longpaths=true fetch -a origin
        npm ERR! fatal: Unable to find remote helper for 'https'
        npm ERR!
        npm ERR!
        npm ERR! If you need help, you may report this error at:
        npm ERR!     <https://github.com/npm/npm/issues>

        npm ERR! Please include the following file with any support request:
        npm ERR!     H:\dev\Pitram\mobileapps\pitramconnect\trunk\node_modules\npm-debug.log
        The following image was skipped because it has an unsupported size (undefinedxundefined):
        resources\android\icon\drawable-xhdpi-icon.png
        --save flag or autosave detected
        Saving windows@~5.0.0 into config.xml file ...

My Ionic info is

ionic info

global packages:

    @ionic/cli-plugin-proxy : 1.3.0
    @ionic/cli-utils        : 1.4.0
    Cordova CLI             : 7.0.1
    Ionic CLI               : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : android 6.1.2 ios 4.3.1 windows 5.0.0
    Ionic Framework                 : ionic-angular 3.3.0

System:

    Node       : v6.11.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 3.10.10

Does anyone have any idea why I am getting this error and how I can get around it?

Thanks in advance

Hm, maybe update node/npm to a more current version? Same for cordova-android and @ionic/app-scripts.

@Sujan12 thanks for the reply. I tried the same on a different (my home) windows machine, and had the same problem.

I uninstalled my node so I could install the latest LTS, also updated app-scripts etc,. and now have the following…

ionic info

global packages:

    @ionic/cli-utils : 1.4.0
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 2.0.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Ionic Framework                 : ionic-angular 3.5.0

System:

    Node       : v6.11.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 5.1.0

I then tried to emulate using a new blank project (created on a mac), and then adding the ios platform, adding the wkwebview, and then transferring over to my windows machine. Doing this, I didn’t even get up to trying to add the windows platform, as I had problems even doing a npm install (same thing problem with the wkwebview)

I decided to add an issue here in the app scripts since it seems to be something to do with running the command to get the package.

1 Like

You should google a bit for the [quote=“peterjc, post:1, topic:97286”]
npm ERR! fatal: Unable to find remote helper for ‘https’
[/quote]error message and try the solutions posted there. There are loads of them.

Yes, I did a lot (and done more) of Googling, but nothing has helped. I can’t even add or remove the wkwebview on Windows. I have added git paths to my environmental variables, and tried changing the "git+https://’ prefix to just git://
ie

<plugin name="cordova-plugin-wkwebview-engine" spec="git://github.com/driftyco/cordova-plugin-wkwebview-engine.git" />

But the error still mentions https…

npm ERR! git fetch -a origin (https://github.com/driftyco/cordova-plugin-wkwebview-engine.git) fatal: Unable to find remote helper for 'https npm ERR! Windows_NT 10.0.15063 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "git+https://github.com/driftyco/cordova-plugin-wkwebview-engine.git" "--save"'

So it is still trying the git+http even though I have removed this from the config.xml.

It just appears having the wkwebview means you can now not use the project on windows anymore. Very weird and frustrating that windows platform should even look at this plugin. Perhaps I need to go back to mac and remove it (but then I loose what i needed the wkwebview for on iOS, unless I just have a different iOS branch (which would be a nightmare for maintenance).

I have just noticed the reference to the wkwebview exists in both package.config and config.xml. I Have removed the wkwebview from each and can now add the windows platform. Perhaps I just need to re-add it for iOS build in a script.

1 Like

Yeah, the duplication in package.json and config.xml can be a nuisance in Cordova 7. Hope this will be removed soon. Let us know if you get it working and how.

I had the same issue, except with cordova-plugin-statusbar, but when i removed from each files and ran ionic cordova plugin add cordova-plugin-statusbar after, i could build and run browser/android again. Thanks.