npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

package-lock file toggles between local and remote on every npm install run

What I Wanted to Do

run npm install and have the package-lock file stay unchanged if no versions and dependencies were changed.

What Happened Instead

package-lock keeps changing my local dependency to a remote one and back on each run of npm install

Reproduction Steps

I used this package.json file:

    "name": "test-toggle",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    "author": "",
    "license": "ISC",
    "dependencies": {
      "miew": "file:modules/miew"

I have a local copy of miew at the specified location modules/miew.

If I run npm install, the package-lock file keeps alternating the miew reference between

   "miew": {
      "version": "file:modules/miew",
      "integrity": "sha1-IUx1YaTZXoosglro9VLrPKMHEDw="


    "miew": {
      "version": "file:https:/",
      "integrity": "sha1-IUx1YaTZXoosglro9VLrPKMHEDw="

every time I run npm install.
I would like it to keep a reference to my local one and not have it change each run of npm install.


Platform Info

$ npm --versions
{ 'test-toggle': '1.0.0',
  npm: '6.8.0',
  ares: '1.15.0',
  cldr: '34.0',
  http_parser: '2.8.0',
  icu: '63.1',
  modules: '67',
  napi: '3',
  nghttp2: '1.34.0',
  node: '11.2.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '',
  zlib: '1.2.11' }
$ node -p process.platform

I have this problem too.