ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

Error: Failed to fetch plugin from a URL

Open neoassyrian opened this issue 6 years ago • 35 comments

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:

neoassyrian avatar Sep 06 '17 23:09 neoassyrian

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

Try updating git on your machine.

imhoffd avatar Sep 07 '17 00:09 imhoffd

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.

neoassyrian avatar Sep 07 '17 04:09 neoassyrian

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

imhoffd avatar Sep 07 '17 14:09 imhoffd

    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

neoassyrian avatar Sep 07 '17 23:09 neoassyrian

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

imhoffd avatar Sep 08 '17 00:09 imhoffd

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

neoassyrian avatar Sep 08 '17 00:09 neoassyrian

What does git submodule -h output?

imhoffd avatar Sep 08 '17 00:09 imhoffd

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 [--] [...]

neoassyrian avatar Sep 08 '17 00:09 neoassyrian

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

neoassyrian avatar Sep 08 '17 00:09 neoassyrian

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

imhoffd avatar Sep 08 '17 00:09 imhoffd

That seems to work fine. No issues.

neoassyrian avatar Sep 08 '17 00:09 neoassyrian

`-- [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.

neoassyrian avatar Sep 08 '17 00:09 neoassyrian

Is there going to be a fix for this?

neoassyrian avatar Sep 12 '17 07:09 neoassyrian

@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.

imhoffd avatar Sep 12 '17 17:09 imhoffd

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

neoassyrian avatar Sep 25 '17 08:09 neoassyrian

The same for me

kleeb avatar Oct 11 '17 15:10 kleeb

same here ...

pvdyck avatar Oct 12 '17 17:10 pvdyck

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

kleeb avatar Oct 12 '17 17:10 kleeb

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

coloz avatar Nov 12 '17 15:11 coloz

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://...

zmoshansky avatar Nov 22 '17 19:11 zmoshansky

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

maikosoft avatar May 30 '18 17:05 maikosoft

@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

L96Github avatar Jun 29 '18 02:06 L96Github

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

imhoffd avatar Jul 12 '18 22:07 imhoffd

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

zmoshansky avatar Jul 12 '18 22:07 zmoshansky

@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" />

imhoffd avatar Jul 12 '18 22:07 imhoffd

@dwieeb gitbash

maikosoft avatar Jul 13 '18 19:07 maikosoft

@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).

zmoshansky avatar Jul 30 '18 18:07 zmoshansky

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

imhoffd avatar Jul 30 '18 19:07 imhoffd

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

zmoshansky avatar Jul 30 '18 22:07 zmoshansky

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

imhoffd avatar Jul 30 '18 22:07 imhoffd