Skip to content

[BUG] Subsequent runs of npm install --install-strategy=linked are slow #6100

@dstaley

Description

@dstaley

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Running npm install --install-strategy=linked immediately following an invocation of the same command isn't as fast as the default hoisted mode. It appears to be running a clean installation of the entire package tree each time.

This also seems to impact adding packages, which means that adding a package takes as much time as installing without a node_modules folder.

Expected Behavior

Subsequent calls to npm install --install-strategy=linked don't do as much work as the initial call, resulting in a faster run.

Steps To Reproduce

Reproduction

  1. npm install (to prime the local cache)
  2. rm -rf node_modules && time npm install --install-strategy=linked
  3. time npm install --install-strategy=linked
  4. rm -rf node_modules && time npm install
  5. time npm install

Environment

  • npm: 9.4.0
  • Node.js: v16.19.0
  • OS Name: Linux
  • System Model Name: N/A
  • npm config:
; node bin location = /usr/bin/node
; node version = v16.19.0
; npm local prefix = /home/dstaley/git/dstaley/npm-linked-slow-install
; npm version = 9.4.0
; cwd = /home/dstaley/git/dstaley/npm-linked-slow-install
; HOME = /home/dstaley
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions