【问题标题】:cordova add plugin - unable to access科尔多瓦添加插件 - 无法访问
【发布时间】:2014-01-20 16:27:50
【问题描述】:

我正在尝试通过

向 Cordova 添加一个插件
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

git 本身似乎运行良好。运行以下工作:

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

这就是 plugins.js 第 43 行中使用的内容(var cmd = util.format(...))。

我使用 cordova 插件 add ... 收到的错误是:

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)

有什么想法吗?

更多信息:

我正在通过代理,但我为 git 和 npm 设置了这个。我通过“npm install cordova”安装了Cordova,通过“cordova create TestApp”安装了项目,通过“cordova platform add android”添加了平台,我可以在模拟器上运行应用程序。

我什至尝试过“phonegap local plugin add https...”,结果相同。

我缺少的就是添加插件。

【问题讨论】:

  • 您能否运行带有-d 标志的cordova plugin add 命令以获得更多输出并查看错误消息是否有所改善?你可以尝试做cordova plugin add org.apache.cordova.device-motion 看看它是否不同(使用插件名称而不是实际的 git url)。另外,尝试删除 \cordova` folder inside your node_modules` 文件夹。这将清除“cordova 缓存”,当 npm 出现升级和/或问题时,有时会搞砸(上周服务器有点傻。)最后,为什么你的临时驱动器在 D:// 但你的命令在C://?
  • 我在输出中添加了额外的行,基本上是前三行(调用 plugman.fetch....)
  • "cordova plugin add org.apache.cordova.device-motion" 抛出 ETIMEDOUT
  • 我已将所有 TEMP 路径变量设置为 D:\Temp 并且用户目录仍在 C:/Users/...
  • 我遇到了同样的问题。请参阅 here 了解适合我的解决方案。

标签: plugins cordova add


【解决方案1】:

有时,Cordova 更新会导致 npm 出现问题,并会损坏 NPM 用于快速下载不同 Cordova 版本的“cordova 缓存”。我知道服务器将最新的 Cordova 插件推送到 NPM 时出现问题,所以也许这就是您遇到问题的原因。

我建议直接完全删除/AppData/Roaming/npm/node_modules/cordova,而不是使用npm install -g cordova 安装一个全新的副本。这不应该删除您的任何 Cordova 项目,它只会下载一组新的工具。当您运行 cordova 命令时,第一次可能需要更长的时间,因为这些工具必须去 git repo 并获取新鲜的内容。

【讨论】:

  • 没有帮助我。但是到目前为止,您有两个赞成票,似乎对其他人有所帮助:)
  • 它也帮助了我。它奏效了,尽管我不明白到底发生了什么:)
【解决方案2】:

尝试按照@mbillau 的建议通过删除文件夹来清除科尔多瓦缓存,但这并没有帮助。我搜索出现错误的插件并尝试通过命令行安装,但得到了相同的错误消息。最后是对我有用的解决方案:

  1. 在 IDE 中打开重要文件
  2. 打开 Cordova 插件
  3. 将所有“https://git-wip-us.apache.org/repos/asf/”替换为“https://git.apache.org/

而且效果很好。

【讨论】:

【解决方案3】:

将“git-wip-us.apache.org/repos/asf7”替换为“github.com/apache/” 就像@Max 所说的那样。

【讨论】:

    【解决方案4】:

    检查 apache 站点(https://git-wip-us.apache.org/repos/asf/https://gitbox.org/repos/asf/https://git.apache.org/)我只看到提交日志而不是源代码。

    可以在 GitHub 上找到源代码。这对我有用: 科尔多瓦插件添加https://github.com/apache/cordova-plugin-device.git

    【讨论】:

      猜你喜欢
      • 2015-08-13
      • 2018-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-13
      • 1970-01-01
      相关资源
      最近更新 更多