'npm ignores git+https setting and uses git+ssh in package-lock.json

We have multiple developers and an npm package that is installed form a public repository on github. while all developers usually have a github account, the CI server obviously doesn't (and usually doesn't need to).

The package from the public repository is installed using git+https://github.com/<author>/<repo>#<branch> however whenever a developer (with ssh installed) is installing another package the depencency in the package-lock.json is changed to git+ssh... which of course fails on the CI server.

is there any way to fix this behaviour?



Solution 1:[1]

Deleting the offending package-lock.json entry/reference and then running these two commands did the trick for me:

  • git config --global url."https://github.com/".insteadOf [email protected]:
  • git config --global url."https://".insteadOf git://

With credit to this article.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dev'd