Ionic-cli: Error: Failed to fetch plugin from a URL

Created on 7 Sep 2017  路  34Comments  路  Source: ionic-team/ionic-cli

Description:
ionic cordova plugin add {URL} fails.
I tried to add the WKWebView as an example on a brand new ionic app, and it failed.
ionic cordova plugin add https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git --save

However, if I run the command without the "ionic" (i.e. using Cordova) it works fine. However, when packaging in the Ionic Cloud, it doesn't seem to work.

cordova plugin add https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git --save

Steps to Reproduce:
Create a new Ionic Blank App
Run: ionic cordova plugin add https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git --save

Output:
C:\mobile\TestApp>ionic cordova plugin add https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git --save

cordova plugin add https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git --save
脳 Running command - failed!
[ERROR] An error occurred while running cordova plugin add

    https://github.com/ionic-team/cordova-plugin-wkwebview-engine... (exit code 1):

    Error: Failed to fetch plugin https://github.com/ionic-team/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 WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
    npm WARN addRemoteGit
    npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:204:12)
    npm WARN addRemoteGit     at emitTwo (events.js:106:13)
    npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
    npm WARN addRemoteGit     at maybeClose (internal/child_process.js:886:16)
    npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:342:11)
    npm WARN addRemoteGit     at emitOne (events.js:96:13)
    npm WARN addRemoteGit     at Socket.emit (events.js:188:7)
    npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:497:12)
    npm WARN addRemoteGit  git+https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git resetting remote
    C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-ionic-team-cordova-plugin-wkwebview-engine-git-ae2e0322
    because of error: { Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
    npm WARN addRemoteGit
    npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:204:12)
    npm WARN addRemoteGit     at emitTwo (events.js:106:13)
    npm WARN addRemoteGit     at ChildProcess.emit (events.js:191:7)
    npm WARN addRemoteGit     at maybeClose (internal/child_process.js:886:16)
    npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:342:11)
    npm WARN addRemoteGit     at emitOne (events.js:96:13)
    npm WARN addRemoteGit     at Socket.emit (events.js:188:7)
    npm WARN addRemoteGit     at Pipe._handle.close [as _onclose] (net.js:497:12)
    npm WARN addRemoteGit   killed: false,
    npm WARN addRemoteGit   code: 1,
    npm WARN addRemoteGit   signal: null,
    npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
    npm ERR! git clone --template=C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror
    https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git
    C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-ionic-team-cordova-plugin-wkwebview-engine-git-ae2e0322:
    Cloning into bare repository
    'C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-ionic-team-cordova-plugin-wkwebview-engine-git-ae2e0322'...
    npm ERR! git clone --template=C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror
    https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git
    C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-ionic-team-cordova-plugin-wkwebview-engine-git-ae2e0322:
    fatal: Unable to find remote helper for 'https'
    npm ERR! Windows_NT 10.0.14393
    npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
    Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
    "https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git" "--save"
    npm ERR! node v6.10.3
    npm ERR! npm  v3.10.10
    npm ERR! code 128

    npm ERR! Command failed: git -c core.longpaths=true clone
    --template=C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror
    https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git
    C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-ionic-team-cordova-plugin-wkwebview-engine-git-ae2e0322
    npm ERR! Cloning into bare repository
    'C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-ionic-team-cordova-plugin-wkwebview-engine-git-ae2e0322'...
    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!     C:\mobile\TestApp\node_modules\npm-debug.log

My ionic info:

cli packages: (C:\mobile\TestApp\node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : android 6.2.3 browser 4.1.0 ios 4.4.0
Ionic Framework    : ionic-angular 3.6.0

System:

Node : v6.10.3
npm  : 3.10.10
OS   : Windows 10

Other Information:

bug

Most helpful comment

replace git+https with https in both config.xml and package.json
this helped for me

All 34 comments

Looks like this is your issue: fatal: Unable to find remote helper for 'https'

Try updating git on your machine.

I had git version 2.13.1 on Windows
I updated to the latest git 2.14.1 now I get a different error.

How come running the same command directly using cordova command, works fine??

Also, the original issue is happening on 2 different computers.

I'm not sure yet. What's the new error?

    Error: Failed to fetch plugin https://github.com/ionic-team/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 submodule -q update --init --recursive: fatal: 'submodule' appears to be a git command, but we were
    not
    npm ERR! git submodule -q update --init --recursive: able to execute it. Maybe git-submodule is broken?
    npm ERR! git submodule -q update --init --recursive:
    npm ERR! Windows_NT 10.0.14393
    npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
    Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
    "https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git" "--save"
    npm ERR! node v6.10.3
    npm ERR! npm  v3.10.10
    npm ERR! code 128

    npm ERR! Command failed: git -c core.longpaths=true submodule -q update --init --recursive
    npm ERR! fatal: 'submodule' appears to be a git command, but we were not
    npm ERR! able to execute it. Maybe git-submodule is broken?
    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!     C:\mobile\TestApp\node_modules\npm-debug.log

How did you install git? It seems to have issues.
What shell are you using?
What's the output of: git --exec-path ?

I just went to the Git web site and downloaded the Git windows installer and installed it
the output of: git --exec-path:
C:\Program Files\Git\mingw64/libexec/git-core

What does git submodule -h output?

C:\mobile\TestApp>git submodule -h
usage: git submodule [--quiet] add [-b ] [-f|--force] [--name ] [--reference ] [--] []
or: git submodule [--quiet] status [--cached] [--recursive] [--] [...]
or: git submodule [--quiet] init [--] [...]
or: git submodule [--quiet] deinit [-f|--force] (--all| [--] ...)
or: git submodule [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference ] [--recursive] [--] [...]
or: git submodule [--quiet] summary [--cached|--files] [--summary-limit ] [commit] [--] [...]
or: git submodule [--quiet] foreach [--recursive]
or: git submodule [--quiet] sync [--recursive] [--] [...]
or: git submodule [--quiet] absorbgitdirs [--] [...]

I think it is the vqariable (-q) should be (--quiet)

What about npm install https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git --save ?

That seems to work fine.
No issues.

`-- [email protected] (git+https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git#3f6be80ecd34ee67a230390f95de8eaf60fdca83)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN [email protected] requires a peer of ajv@>=5.0.0 but none was installed.

Is there going to be a fix for this?

@neoassyrian I would just use the Cordova CLI directly. I may start recommending people do this normally. The ionic cordova platform and ionic cordova plugin commands offer little benefit over cordova platform and cordova plugin. We just added them to fully wrap it.

This is not working in the cloud either when running "ionic package build" command. Getting the original error.

The same for me

same here ...

replace git+https with https in both config.xml and package.json
this helped for me

same,using npm or cordova to install is ok,but using ionic is error

Inline with what @kleeb mentioned, changing the following path prefixes in config.xml && package.json seems to have alleviated the issue in a permanent manner.

git+https://... -> https://...
git+ssh://... -> ssh://...

@dwieeb Thank's, updating git work for me.

@neoassyrian I would just use the Cordova CLI directly. I may start recommending people do this normally. The ionic cordova platform and ionic cordova plugin commands offer little benefit over cordova platform and cordova plugin. We just added them to fully wrap it.

@dwieeb 's suggestion worked for me straightaway.
just use the Cordova CLI directly wihtout ionic wrapper:

cordova plugin add https://github.com/ionic-team/cordova-plugin-wkwebview-engine

@maikosoft @L96Github @zmoshansky @coloz @pvdyck @kleeb May I ask if you are using Windows with Command Prompt or Git Bash?

MacOS, zsh, git; Team-mates also experienced similar on MacOS, bash? (default iterm2), git.

@zmoshansky Okay, I use the same. Can I see all the <plugin elements in your config.xml? On my computer it added the plugin successfully with this command:

ionic cordova plugin add https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git

Installs the plugin and puts this in my config.xml:

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

@dwieeb gitbash

@dwieeb, I can share the following:

This is a fork of a plugin that we use,
ionic cordova plugin add git+https://github.com/flipflopapp/cordova-universal-links-plugin fails
ionic cordova plugin add https://github.com/flipflopapp/cordova-universal-links-plugin succeeds.

We have one other forked plugin that also has the same issue; In both cases, I've noticed the package.json contains the original repo url, instead of the forked repo url. Is it possible the git+ prefix causes the package.json to be checked and errors when the url's don't align or elicits this error?

I would intuitive expect that prefixed or not, those commands should behave consistently.
(IIRC, some tooling causes these to have git+ prefix re-added constantly, thus the battle back and forth).

For me, those commands save the correct forked URL to config.xml and package.json.

git+ prefix:

ionic cordova plugin add git+https://github.com/flipflopapp/cordova-universal-links-plugin 
    <plugin name="cordova-universal-links-plugin" spec="git+https://github.com/flipflopapp/cordova-universal-links-plugin.git" />
    "cordova-universal-links-plugin": "git+https://github.com/flipflopapp/cordova-universal-links-plugin.git",

no git+ prefix:

ionic cordova plugin add https://github.com/flipflopapp/cordova-universal-links-plugin 
    <plugin name="cordova-universal-links-plugin" spec="https://github.com/flipflopapp/cordova-universal-links-plugin.git" />
    "cordova-universal-links-plugin": "git+https://github.com/flipflopapp/cordova-universal-links-plugin.git",

I think Cordova/npm always adds the git+ prefix to package.json because just the URL isn't a valid URL according to the package.json spec: https://docs.npmjs.com/files/package.json#git-urls-as-dependencies

Output when run this morning...

ionic cordova plugin add git+https://github.com/flipflopapp/cordova-universal-links-plugin.git
> cordova plugin add git+https://github.com/flipflopapp/cordova-universal-links-plugin.git --save
Error: Failed to fetch plugin git+https://github.com/flipflopapp/cordova-universal-links-plugin.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 subprocess cordova.

        cordova plugin add git+https://github.com/flipflopapp/cordova-universal-links-pl... exited with exit code 1.
Ionic:

   ionic (Ionic CLI)  : 4.0.1 (/......./.nvm/versions/node/v6.12.2/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.11

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : ios 4.5.4

System:

   ios-deploy : 1.9.2
   ios-sim    : 6.1.2
   NodeJS     : v6.12.2 (/......../.nvm/versions/node/v6.12.2/bin/node)
   npm        : 3.10.10
   OS         : macOS High Sierra
   Xcode      : Xcode 9.3.1 Build version 9E501

Environment:

   ANDROID_HOME : not set

It's a mystery. I'll never be able to reproduce this issue 馃槀

Ionic:

   ionic (Ionic CLI)  : 4.0.1 (/Users/dan/ionic-team/ionic-cli/packages/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.10

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : browser 5.0.3, ios 4.5.4

System:

   Android SDK Tools : 26.1.1
   NodeJS            : v8.11.2 (/Users/dan/.nvm/versions/node/v8.11.2/bin/node)
   npm               : 5.10.0
   OS                : macOS High Sierra
   Xcode             : Xcode 9.4.1 Build version 9F2000

Environment:

   ANDROID_HOME : /Users/dan/Library/Android/sdk

@dwieeb I'm suspect of this perhaps stemming from npm 3 / node 5 in my case, vs npm 5 and node 8 on yours. Unfortunately we still have some deps to upgrade before we can move to node 8/npm 5.

I've tested node 6 + npm 3 before. I just did again, and got the same behavior as before.

Ionic:

   ionic (Ionic CLI)  : 4.0.1 (/Users/dan/.nvm/versions/node/v6.13.1/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.10

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : browser 5.0.3, ios 4.5.4

System:

   Android SDK Tools : 26.1.1
   NodeJS            : v6.13.1 (/Users/dan/.nvm/versions/node/v6.13.1/bin/node)
   npm               : 3.10.10
   OS                : macOS High Sierra
   Xcode             : Xcode 9.4.1 Build version 9F2000

Environment:

   ANDROID_HOME : /Users/dan/Library/Android/sdk

I thought originally it was an issue with the git version. But I'm stumped as to why it works for Cordova CLI, but not when Ionic CLI wraps the exact same command.

This command fixed it for me:
git config --global url."https://".insteadOf git+https://

I spent hours on this. Downgrading from Cordova 10.0.0 to 9.0.0 ([email protected]) worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rashnk picture rashnk  路  3Comments

chsakell picture chsakell  路  3Comments

mpaland picture mpaland  路  3Comments

richardshergold picture richardshergold  路  3Comments

patwaswapnil picture patwaswapnil  路  3Comments