npm / npm/cli

[BUG] workspaces `install-strategy = "nested"` does not install/ignores dependencies

Open
#6,874 3 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2 Release 10.x Release 9.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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

npm does not install dependencies of package-b when install-strategy = "nested", and package-b is nested in another package (package-a). Not in the root of the workspace or the package itself.

- package-a
  - package-b
    package.json (dependencies of b)
  package.json (dependencies of a)
- package.json (workspaces)
Expected Behavior

Install the dependencies of package-b.

Steps To Reproduce
  1. clone https://github.com/samuelstroschein/reproduction-npm-nested-packages-bug
  2. run npm i
Environment
  • npm: v8/v9/v10 happens on every version of npm
  • Node.js: v18/v20
  • OS Name: Mac OS
  • System Model Name:
  • npm config:
; "user" config from /Users/samuel/.npmrc

access = "public" 
legacy-peer-deps = false 

; "project" config from /Users/samuel/Desktop/repro/.npmrc

install-strategy = "nested" 

; node bin location = /Users/samuel/.nvm/versions/node/v20.8.0/bin/node
; node version = v20.8.0
; npm local prefix = /Users/samuel/Desktop/repro
; npm version = 10.1.0
; cwd = /Users/samuel/Desktop/repro
; HOME = /Users/samuel
; Run `npm config ls -l` to show all defaults.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked reproduction repository and run npm i with install-strategy = "nested" enabled in .npmrc; inspect the workspace layout involving package-a and nested package-b. Confirm the missing dependencies and trace npm's workspace installation behavior. Done means package-b's dependencies are installed when package-b is nested under package-a.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.