Skip to content

fix(arborist): node.target can be null when it is a file dep or symlink - #7027

Merged
lukekarrys merged 8 commits into
npm:latestfrom
ljharb:null-target
Dec 6, 2023
Merged

fix(arborist): node.target can be null when it is a file dep or symlink#7027
lukekarrys merged 8 commits into
npm:latestfrom
ljharb:null-target

Conversation

@ljharb

@ljharbljharb commented Nov 26, 2023

Copy link
Copy Markdown
Contributor

This avoids a Cannot read properties of null (reading 'realpath') error when installing a tree that contains, eg, https://npmjs.com/has-package-exports which has a file dep in it.

May relate to other issues with similar errors; I'm happy to add a test but I'm not sure how to repro it outside of my project.

(I'll want to backport this as far back as possible once it lands in 10, so a test would be quite helpful to have)

@ljharb
ljharb requested a review from a team as a code ownerNovember 26, 2023 22:18
@wraithgar

Copy link
Copy Markdown
Contributor

Unfortunately the test is The Thing for this bug. Many PRs have been started but none provides a test that shows the root cause. Without that we're just fixing it by accident. We have to know why this happens to know if this fix is the right one.

Comment threadworkspaces/arborist/test/fixtures/file-dep/fake/package.json
Comment threadworkspaces/arborist/lib/arborist/load-actual.js Outdated
@lukekarrys
lukekarrys merged commit ae2d982 into npm:latestDec 6, 2023
@ljharb
ljharb deleted the null-target branch December 6, 2023 19:30
@ljharb

Copy link
Copy Markdown
ContributorAuthor

<3 thank you!

@github-actionsgithub-actionsBot mentioned this pull request Dec 6, 2023
ljharb added a commit to ljharb/cli that referenced this pull request Dec 6, 2023
…ymlink (npm#7027)
Co-authored-by: Luke Karrys <luke@lukekarrys.com>
@ljharbljharb added ws:arborist Related to the arborist workspace Release 10.x labels Dec 6, 2023
@ljharb

Copy link
Copy Markdown
ContributorAuthor

Created #7059 for v9.

ljharb added a commit to ljharb/cli that referenced this pull request Dec 8, 2023
ljharb added a commit to ljharb/cli that referenced this pull request Dec 16, 2023
ljharb added a commit to ljharb/cli that referenced this pull request Jan 16, 2024
ljharb added a commit to ljharb/cli that referenced this pull request Jan 18, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release 10.xws:arboristRelated to the arborist workspace

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@ljharb@wraithgar@lukekarrys