NPM install skips over git URLs if package-lock.json is missing.

What I Wanted to Do

I have a few dependencies that I’ve installed using git URLs (not on GitHub). However I do not git track my package-lock.json. When I want to do a fresh npm install with just the package.json, I expect all my dependencies, including those pointing to git URLs to install.

What Happened Instead

Instead NPM skips over my git URL packages. It is worth mentioning this does not occur using github URLs - only custom git hosting.

  1. Install a package A in a project B.
npm i git+https://username:password@giturl.com/username/A
  1. Remove package-lock.json and commit.

  2. Remove project and git clone B from scratch.

  3. Now you should have a package.json with A pointing to git+https://username:password@giturl.com/username/A.

  4. npm i. Nothing installs.

Details

This behavior does not occur when using github URLs.

Platform Info

$ npm --versions

{ app4: '1.0.0',
  npm: '6.10.1',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  modules: '64',
  napi: '4',
  nghttp2: '1.34.0',
  node: '10.16.0',
  openssl: '1.1.1b',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.28.0',
  v8: '6.8.275.32-node.52',
  zlib: '1.2.11' }

$ node -p process.platform

darwin