Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ERR! this.idealTree.children.get is not a function #7029

Open
2 tasks done
maksimr opened this issue Nov 27, 2023 · 7 comments
Open
2 tasks done

[BUG] ERR! this.idealTree.children.get is not a function #7029

maksimr opened this issue Nov 27, 2023 · 7 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x

Comments

@maksimr
Copy link

maksimr commented Nov 27, 2023

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

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
  1. Run
mk /tmp/bar \
  && pushd /tmp/bar \
  && npm init -y \
  && npm init -y -w foo-1 \
  && npm install --install-strategy=linked -w foo-1
  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.
@maksimr maksimr added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Nov 27, 2023
@maksimr
Copy link
Author

maksimr commented Nov 27, 2023

Just proof of concept. All works fine if modify this line

image

this.idealTree.children in case of "linked" strategy contains Array instead of Set

@ljharb
Copy link
Collaborator

ljharb commented Nov 27, 2023

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.

@maksimr
Copy link
Author

maksimr commented Nov 27, 2023

Where is it created as an Array?

It replaced on Array here -> isolated-reifier

@ljharb
Copy link
Collaborator

ljharb commented Nov 27, 2023

and would wrapping that array in new Set() fix the problem?

@maksimr
Copy link
Author

maksimr commented Nov 27, 2023

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:

  1. Install all dependencies
  2. Does not link some modules

: (

@ljharb
Copy link
Collaborator

ljharb commented Nov 27, 2023

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.

@maksimr
Copy link
Author

maksimr commented Nov 27, 2023

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)

1j01 added a commit to 1j01/tracky-mouse that referenced this issue Apr 18, 2024
Electron Forge doesn't work with npm workspaces.
See: #53
And: electron/forge#2306
And: npm/cli#7029
And: npm/rfcs#287

This gets the app working when packaged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x
Projects
None yet
Development

No branches or pull requests

2 participants