Dinkheller
Dinkheller

Reputation: 5074

cordova add plugin - unable to access

I am trying to add a plugin to Cordova via

cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

git itself seems to run fine. Running the following works:

git clone "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git" "D:\Temp\plugman-tmp1390234462383"

This is what is used in plugins.js line 43 (var cmd = util.format(...)).

The error I receive using the cordova plugin add ... is:

Calling plugman.fetch on plugin "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git"
Fetching plugin from "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git"...
Fetching plugin via git-clone command: git clone "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git" "D:\Temp\plugman-tmp1390235833828"

C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error: Fetching plugin failed: Error: Command failed: Cloning into 'D:\Temp\plugman-tmp1390234462383'...
fatal: unable to access 'https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git/': Failed connect to git-wip-us.apache.org:443; No error

at C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\src\plugin.js:90:41
at _rejected (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:808:24)
at C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:834:30
at Promise.when (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:752:41)
at C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:574:44
at flush (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)

Any idea?

Some more information:

I am going through a proxy, but I set this for git and for npm. I installed Cordova via "npm install cordova" and the project via "cordova create TestApp", I added platforms via "cordova platform add android" and I can run the app on the emulator.

I even tried "phonegap local plugin add https..." with the same result.

All that is missing for me is to add plugins.

Upvotes: 2

Views: 9128

Answers (4)

Tai Truong
Tai Truong

Reputation: 778

Checking the apache site (either https://git-wip-us.apache.org/repos/asf/, https://gitbox.org/repos/asf/, or https://git.apache.org/) I only see commit logs instead of the sources.

The sources can be found on GitHub. This worked for me: cordova plugin add https://github.com/apache/cordova-plugin-device.git

Upvotes: 0

beesop
beesop

Reputation: 11

Replace "git-wip-us.apache.org/repos/asf7" with "github.com/apache/" Like @Max said.

Upvotes: 1

Deepak Kikan
Deepak Kikan

Reputation: 21

Tried clearing the cordova cache by deleting the folder as suggested by @mbillau but that didn't help. I search for the plugin where I was getting the error and tried installing through command line but got the same error message. Finally the solution that worked for me:

  1. open important files in your IDE
  2. open Cordova plugins
  3. replace all "https://git-wip-us.apache.org/repos/asf/" with "https://git.apache.org/"

and it worked perfectly.

Upvotes: 1

MBillau
MBillau

Reputation: 5376

Sometimes a Cordova update will cause problems with npm and will corrupt the "cordova cache" that NPM uses to quickly download different Cordova versions. I know there were problems with the server pushing the latest Cordova plugins to NPM, so maybe this is why you're having trouble.

I'd suggest deleting /AppData/Roaming/npm/node_modules/cordova direct in its entirety, than installing a fresh new copy with npm install -g cordova. This shouldn't remove any of your Cordova projects, it will just download a fresh set of the tools. When you run cordova commands, it might take longer the first time since the tools will have to go to the git repo's and fetch the content fresh.

Upvotes: 5

Related Questions