从GitLab私人仓库添加cordova插件

时间:2017-09-06 15:44:27

标签: git cordova ionic-framework gitlab cordova-plugins

cordova plugin add http://gitlab.com/<user>/<private-repo>.git

我无法在GitLab中添加来自私人仓库的cordova插件。当我运行上面的命令时,它会抛出以下错误:

Error: Failed to fetch plugin http://gitlab.com/<user>/<private-repo>.git via registry.
    Probably this is either a connection problem, or plugin spec is incorrect.
    Check your connection and plugin name/version/URL.
    Error: npm: Command failed with exit code 1 Error output:
    npm ERR! fetch failed http://gitlab.com/<user>/<private-repo>.git
    npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 401
    npm ERR! fetch failed http://gitlab.com/<user>/<private-repo>.git
    npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 401
    npm ERR! fetch failed http://gitlab.com/<user>/<private-repo>.git
    npm ERR! Darwin 16.7.0
    npm ERR! argv "~/.nvm/versions/node/v6.4.0/bin/node" 
    "~/.nvm/versions/node/v6.4.0/bin/npm" "install" 
    "http://gitlab.com/<user>/<private-repo>.git" "--save"
    npm ERR! node v6.4.0
    npm ERR! npm  v3.10.3

    npm ERR! fetch failed with status code 401
    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:

注意:我使用的是cordova 7.0.1

我可以看到状态代码是401.我接受了从私人仓库获取的密码提示,但不幸的是不是这样。 similar question被问到但我不想克隆回购并通过本地文件夹添加。任何形式的帮助将不胜感激。谢谢:))

3 个答案:

答案 0 :(得分:2)

尝试以下操作,使用最新版本的Cordova从私有GitLab存储库添加插件。

<#list users as user>${user}<#sep>, </#list>

答案 1 :(得分:2)

--no-fetch解决方法的问题是......未获取插件。

版本7.x和8.x的Cordova问题跟踪器中引用了相关的未解决问题:

我找到了两个解决办法:

  • 克隆repo并添加引用本地路径的插件(请参阅comment in CB-13507
  • 降级到Cordova v6.x以添加插件然后回滚到最新版本

答案 2 :(得分:0)

你需要取消这个插件。因此,您需要运行该命令:

sudo cordova plugin add http://gitlab.com/<user>/<private-repo>.git --save --nofetch

此致