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

I am unable to add a cordova plugin from a private repo in GitLab. 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

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

3 Answers 3

10

Try the following to add a plugin from a private GitLab repository using the latest version of Cordova.

cordova plugin add git+ssh://[email protected]:<group|user>/<repo>#<branch>
Sign up to request clarification or add additional context in comments.

Comments

3

The problem with the --no-fetch work-around is... that the plugin is not fetched.

There are related open issues referenced in Cordova issue tracker for versions 7.x and 8.x:

I found two work-around:

  • clone the repo and add the plugin referring to the local path (see comment in CB-13507)
  • downgrade to Cordova v6.x to add your plugin then rollback to latest version

Comments

1

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

1 Comment

I have tried this but it doesn't work. Thanks for answering.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.