Skip to content

[BUG] incorrect resolution of relative paths with install-strategy=linked #7549

Closed

Description

@rotu

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

Activity

  1. added
    Bugthing that needs fixing
    Needs Triageneeds review for next steps
    on May 22, 2024
  2. d00rsfan commented on Mar 25, 2025

    @d00rsfan

    1 year gone, bug with erroneous attempt to resolve package on one level above is still persisting :(

  3. added
    Priority 2secondary priority issue
    and removed
    Needs Triageneeds review for next steps
    on Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions