[英]Add cordova plugin from GitLab private repo
cordova plugin add http://gitlab.com/<user>/<private-repo>.git
I am unable to add a cordova plugin from a private repo in GitLab. 我无法从GitLab的私人仓库中添加cordova插件。 When I run the above command it throws me the following error: 当我运行以上命令时,它引发以下错误:
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:
Note : I am using cordova 7.0.1 注意 :我正在使用cordova 7.0.1
I can see that status code is 401. I was accepting a password prompt for fetching from the private repo but unfortunately thats not the case. 我可以看到状态码是401。我正在接受密码提示,以便从私人仓库中提取信息,但不幸的是,情况并非如此。 similar question was asked but I don't want to clone the repo and add via local folder. 有人问过类似的问题 ,但我不想克隆存储库并通过本地文件夹添加。 Any kind of help will be appreciated. 任何帮助将不胜感激。 Thanks :) 谢谢 :)
尝试以下操作,使用最新版本的Cordova从私有GitLab存储库添加插件。
cordova plugin add git+ssh://git@gitlab.example.com:<group|user>/<repo>#<branch>
The problem with the --no-fetch
work-around is... that the plugin is not fetched. --no-fetch
解决方法的问题是...未提取插件。
There are related open issues referenced in Cordova issue tracker for versions 7.x and 8.x: Cordova问题跟踪器针对版本7.x和8.x引用了相关的未解决问题:
I found two work-around: 我发现了两种解决方法:
you need to no-fetch this plugin. 您无需提取此插件。 So, you need to run that command: 因此,您需要运行该命令:
sudo cordova plugin add http://gitlab.com/<user>/<private-repo>.git --save --nofetch
Regards 问候
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.