[BUG] workspaces `install-strategy = "nested"` does not install/ignores dependencies
Is there an existing issue for this?
- [X] I have searched the existing issues
This issue exists in the latest npm version
- [X] 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
- clone https://github.com/samuelstroschein/reproduction-npm-nested-packages-bug
- 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.
maybe related https://github.com/npm/cli/issues/4774 but npm <8.5 also doesn't work
I think I'm having this same issue. It seems like a standard install-strategy="nested" just doesn't work at all. Anybody know if there are any updates on this?
npm i --install-strategy=nested pkg_name is the only way I have found that works consistently. This will result in the proper nested config in package-lock.json. Use npm i once you have the package-lock.json. Putting "config": { "install-strategy": "nested" } in the pkg_name package.json does not work.