Skip to content

[BUG] npm install does not honor packages installed with --install-links #5965

@mlemoine-clgx

Description

@mlemoine-clgx

Is there an existing issue for this?

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Installing a package with --install-links false, deleting node_modules, then running npm install reinstalls the module as a link and updates package-lock.json

Expected Behavior

npm install should honor and not change package-lock.json, the package should be copied, not linked

Steps To Reproduce

  1. git clone https://github.com/oshi97/install-links.git
  2. cd parent
  3. npm i --no-install-links ../child
  4. ls -l node_modules
  5. cat package-lock.json
  6. rm -Recurse -Force node_modules
  7. npm install
  8. ls -l node_modules
  9. cat package-lock.json

At step 4: d---- 2022-12-14 12:21 PM child

At step 5:

    "node_modules/child": {
      "version": "1.0.0",
      "resolved": "file:../child",
      "license": "ISC"
    }
  },
  "dependencies": {
    "child": {
      "version": "1.0.0"
    }
  }

At step 8: l---- 2022-12-14 12:23 PM child -> <REPO>\child\

At step 9:

 "node_modules/child": {
      "resolved": "../child",
      "link": true
    }
  },
  "dependencies": {
    "child": {
      "version": "file:../child"
    }
  }

Environment

  • npm: 8.19.2
  • Node.js: 18.12.1
  • OS Name: Windows 11
  • npm config:
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v18.12.1
; npm local prefix = <REPO>\parent
; npm version = 8.19.2
; cwd = <REPO>\parent
; HOME = <HOME>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions