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] Interdependent local dependencies broken between 8.19.3 and 9.1.1 #5868

Closed
2 tasks done
mind-bending-forks opened this issue Nov 18, 2022 · 2 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release

Comments

@mind-bending-forks
Copy link

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

When referencing a dependency via a local path, which itself references another local path dependency, npm install fails. This was working correctly up to npm 8.19.3, and fails with npm 9.1.1 and npm 9.1.2.

Expected Behavior

npm install should work without error, as it does with npm 8.19.3.

Steps To Reproduce

With the following setup:

/home/myuser/npm-bug/package.json:

{
  "name": "myproj",
  "version": "1.0.0",
  "dependencies": {
    "@myorg/my-other-lib": "file:./myorg/my-other-lib"
  }
}

/home/myuser/npm-bug/myorg/mylib/package.json:

{
  "name": "mylib",
  "version": "1.0.0"
}

/home/myuser/npm-bug/myorg/my-other-lib/package.json

{
  "name": "my-other-lib",
  "version": "1.0.0",
  "dependencies": {
    "mylib": "file:../mylib"
  }
}

npm install in /home/myuser/npm-bug fails when using npm 9.1.1 and 9.1.2 with

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/myuser/npm-bug/node_modules/@myorg/mylib/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/myuser/npm-bug/node_modules/@myorg/mylib/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

Environment

  • npm: 9.1.2
  • Node.js: v18.12.1
  • OS Name: Ubuntu 22.04
  • System Model Name: Not sure this is relevant. It's running in a VM anyhow.
  • npm config:
; "cli" config from command line options

location = "project" 

; node bin location = /usr/local/bin/node
; node version = v18.12.1
; npm local prefix = /home/myuser/npm-bug
; npm version = 9.1.2
; cwd = /home/myuser/npm-bug
; HOME = /home/myuser
; Run `npm config ls -l` to show all defaults.```
@mind-bending-forks mind-bending-forks added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels Nov 18, 2022
@mind-bending-forks
Copy link
Author

As noted in rustwasm/book#283 (comment), the default value of the install-links config parameter changed from false in v8 to true in v9. With npm 9.1.2, setting install-links back to false, via

npm config set install-links=false

for example, makes the error messages reported above go away. I don't know whether this should be working without error with install-links set to true as well, or whether a better/more informative error message should be being supplied in that case.

Note also that messages of the form

WARN tarball tarball data for mylib@file:/home/myuser/npm-bug/node_modules/@myorg/mylib (null) seems to be corrupted. Trying again.

are sometimes produced when install-links is set to true.

@lukekarrys
Copy link
Contributor

Thanks for the report. We're tracking this in #5733 and #5820 so I'm going to close this one. It should be working with both flags, with the only difference being whether the directories end up symlinked or not inside node_modules/

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 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

No branches or pull requests

2 participants