npm install fails, git urls of dependencies are replaced in package*.json files

What I Did

I have some project specific modules, which are used in other node projects. All the modules were in local git repo & installed with npm install git+ssh://... url. The modules were pushed to remote git service. So, the git urls in package.json & package-lock.json were replaced with new git url. Example: github.local.com is changed to gitlab.com.

What I Wanted to Do

I wanted to run npm install & see if the url changes are working properly.

What Happened Instead

In few node projects, npm install worked fine. In some other projects, npm install was failing for one specific package.

Error: /usr/bin/git ls-remote -h -t git@gitlab.local.com:/utils.git

npm install failed for same module in multiple node projects.

I tried to install the failing module, in other project, where npm install worked. Over there, the module got installed from git, normally. But, in the projects, where npm install was failing, npm install git@gitlab.com:<username>/utils.git is also failed. I suspected package.json file. I copied that to another project where npm install worked. Then ran npm install. It worked this time. Then I copied package-lock.json file from project npm install failed to the project npm installed worked. Then I ran npm install. This time, npm install failed. package-lock.json doesn’t have a references of old git url.

Reproduction Steps

I do not have reproduction steps yet. I will update, if I could come up with.

Platform Info

$ npm --versions
{ 'some-service-service': '1.0.0',
  npm: '6.5.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '34.0',
  http_parser: '2.8.0',
  icu: '63.1',
  llhttp: '1.0.1',
  modules: '67',
  napi: '4',
  nghttp2: '1.34.0',
  node: '11.9.0',
  openssl: '1.1.1a',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.25.0',
  v8: '7.0.276.38-node.16',
  zlib: '1.2.11' }
$ node -p process.platform
linux

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.