[BUG] ERR! this.idealTree.children.get is not a function
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
Get an error when try to install dependencies for specific workspace using "linked" strategy
mk bar \
&& pushd bar \
&& npm init -y \
&& npm init -y -w foo-1 \
&& npm install --install-strategy=linked -w foo-1
Expected Behavior
Install dependencies only for passed workspace using "linked" strategy
Steps To Reproduce
Darwin 23.2.0
node v20.9.0
npm v10.1.0
- Run
mk /tmp/bar \
&& pushd /tmp/bar \
&& npm init -y \
&& npm init -y -w foo-1 \
&& npm install --install-strategy=linked -w foo-1
- See error:
npm ERR! this.idealTree.children.get is not a function
Environment
- npm: v10.1.0
- Node.js: v20.9.0
- OS Name: Darwin 23.2.0
- System Model Name: MacBook Air
- npm config:
; node bin location = /Users/maksimrv/.nvm/versions/node/v20.9.0/bin/node
; node version = v20.9.0
; npm local prefix = /private/tmp/bar
; npm version = 10.1.0
; cwd = /private/tmp/bar
; HOME = /Users/maksimrv
; Run `npm config ls -l` to show all defaults.
Just proof of concept. All works fine if modify this line
this.idealTree.children in case of "linked" strategy contains Array instead of Set
Seems like perhaps the bug, then, is that it doesn't always contain a Set. Where is it created as an Array? perhaps that can be changed instead.
and would wrapping that array in new Set() fix the problem?
and would wrapping that array in
new Set()fix the problem?
Yah, if add something like this:
root.children = new Map(root.children.map(c => [c.name, c]))
fixes error but looks like it doesn't work correctly because:
- Install all dependencies
- Does not link some modules
: (
not new Map, new Set - since you said it's a Set in the other code paths.
There may be other places that assume it's an array that also need updating, ofc.
not new Map, new Set - since you said it's a Set in the other code paths.
There may be other places that assume it's an array that also need updating, ofc.
Actually, there is a Map not a Set. I'm not sure why I wrote Set
const ideal = this.idealTree.children.get(ws)
Hi, any update on this issue?
Can't have two version of a package installed with npm, can't fix it due to this bug :/