-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
fix(arborist): node.target
can be null
#7065
base: latest
Are you sure you want to change the base?
Conversation
Followup to npm#7027
a node 16 test failed but since node 16 isn't supported anymore, i assume those tests can be dropped (and node 21 added)? |
b261403
to
d6826f1
Compare
ba5978b
to
ba53945
Compare
I am still planning to add a failing test case for this in smoke-tests, but I do think this fix looks good. |
Thanks! I'm looking forward to it landing and being unblocked, and if there's anything concrete I can do to hurry it along I'd love pointers. |
I am getting a related
Using arborist@7.3.1 in node@v21.6.2 for a package with some dependencies as file: symlinks (with some being inter-dependent). Stacktrace: at [addToBuildSet] (/Users/myname/my-package/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:270:22)
at [buildQueues] (/Users/myname/my-package/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:210:41)
at [build] (/Users/myname/my-package/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:182:29)
at Arborist.rebuild (/Users/myname/my-package/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:100:25)
at async [reifyPackages] (/Users/myname/my-package/node_modules/@npmcli/arborist/lib/arborist/reify.js:252:11)
at async Arborist.reify (/Users/myname/my-package/node_modules/@npmcli/arborist/lib/arborist/reify.js:171:5) |
@dmnsgn That looks like a different bug. Can you open a new issue about it including your package.json with the interdependent symlinks? |
Sorry, I am having a hard time making a reduced case but a clue for solving the issue is removing a leftover npm info using npm@10.2.4
npm info using node@v21.6.2
// ...
npm verb stack TypeError: Cannot read properties of undefined (reading 'target')
npm verb stack at Query.execWorkspaces (/usr/local/lib/node_modules/npm/lib/commands/query.js:104:33)
npm verb stack at async module.exports (/usr/local/lib/node_modules/npm/lib/cli-entry.js:61:5) Not sure it is worth opening an issue if I can't provide repro easily but maybe the above might help someone or "leftover package-lock" might ring a bell to someone who's worked on this. |
Another clue is: one of the workspace was dependent on another workspace but its dependency version was different. Example:
That solves it for me so I'll stop here and open another issue if I encounter these errors again. Hope that helps someone. |
I am getting an error about the target being null but this PR did not fix it |
…#7579) <!-- What / Why --> If a node represents a symbolic link or a file dep (node.isLink is true), its target is expected to reference another node in the dependency tree. If the linking is not done correctly or is incomplete, node.target might be null. <!-- Describe the request in detail. What it does and why it's being changed. --> in this PR, a null check is added to ensure node.target is not null or before proceeding, which will prevent causing errors like: `npm error Cannot set properties of null (setting 'peer')` ## References Related to #7065, Fixes #6622, #5007, Closes #6622, #5007
Followup to #7027. Fixes #6815.
Fixes this issue: https://github.com/ljharb/list-exports/actions/runs/7537180864/job/20515721981