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] incorrect resolution of relative paths with install-strategy=linked #7549

Open
2 tasks done
rotu opened this issue May 22, 2024 · 0 comments
Open
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@rotu
Copy link
Contributor

rotu commented May 22, 2024

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

I have a package with a relative path dependency.

File /Users/dan/Source/project1/package.json

{
  "dependencies": {
    "project2": "file:./project2"
  }
}

And the file /Users/dan/Source/project1/project2/package.json exists.

This installs fine with every install strategy except linked where I receive the below error:

$ npm install --install-strategy linked
npm warn reify The "linked" install strategy is EXPERIMENTAL and may contain bugs.
npm warn tarball tarball data for project2@file:../project2 (null) seems to be corrupted. Trying again.
npm warn tarball tarball data for project2@file:../project2 (null) seems to be corrupted. Trying again.
npm error code ENOENT
npm error syscall open
npm error path /Users/dan/Source/project2/package.json
npm error errno -2
npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/Users/dan/Source/project2/package.json'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
npm error A complete log of this run can be found in: /Users/dan/.npm/_logs/2024-05-22T02_17_21_083Z-debug-0.log

Note that:

  1. The error mentions project2@file:../project2, which is not the depended path.
  2. The path that it's looking for package.json is at /Users/dan/Source/project2/package.json, NOT /Users/dan/Source/project1/project2/package.json

Expected Behavior

The package should install correctly.

Steps To Reproduce

see above

Environment

  • npm: 10.8.0
  • Node.js: 22.2.0
  • OS Name: macOS
  • System Model Name:
  • npm config:
; copy and paste output from `npm config ls` here
@rotu rotu added Bug thing that needs fixing Needs Triage needs review for next steps labels May 22, 2024
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
Projects
None yet
Development

No branches or pull requests

1 participant