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] local transitive dependencies cannot be installed with --install-links=true #5733

Open
2 tasks done
jkowalleck opened this issue Oct 23, 2022 · 6 comments
Open
2 tasks done
Assignees
Labels
Bug thing that needs fixing Priority 0 will get attention right away Release 9.x work is associated with a specific npm 9 release

Comments

@jkowalleck
Copy link

jkowalleck commented Oct 23, 2022

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

cannot install my project which has local transitive dependencies.
npm install crashes with an error message

Expected Behavior

i can install my project which has local transitive dependencies, all local packages are symlinked into the "node_modules" dir.

Steps To Reproduce

i am using this dummy project: https://github.com/CycloneDX/cyclonedx-node-npm/tree/main/demo/local-dependencies/project

  1. git clone https://github.com/CycloneDX/cyclonedx-node-npm.git
  2. cd demo/local-dependencies/project
  3. run npm i
  4. See error
    npm ERR! code ENOENT
    npm ERR! syscall open
    npm ERR! path /.../cyclonedx-node-npm/demo/local-dependencies/project/node_modules/my-local-b/package.json
    npm ERR! errno -2
    npm ERR! enoent ENOENT: no such file or directory, open '/.../cyclonedx-node-npm/demo/local-dependencies/project/node_modules/my-local-b/package.json'
    npm ERR! enoent This is related to npm not being able to find a file.
    npm ERR! enoent
    

Environment

  • npm: 9.0.0
  • Node.js: v16.18.0
  • OS Name: ubuntu 22.04
  • System Model Name: some old thinkpad
  • npm config:
; node bin location = /usr/bin/node
; node version = v16.18.0
; npm local prefix = /.../cyclonedx-node-npm/demo/local-dependencies/project
; npm version = 9.0.0
; cwd = /.../cyclonedx-node-npm/demo/local-dependencies/project/packages
; HOME = /home/...
; Run `npm config ls -l` to show all defaults.

additionally i had the reproducible steps running in a matrix:
see https://github.com/CycloneDX/cyclonedx-node-npm/actions/runs/3306123198

This setup worked as expected in a test matrix of npm{6,7,8} {windows,macos,ubuntu} node{14,16,18} (=27 passes)

This setup failed with a matrix of npm{9} {windows,macos,ubuntu} node{16,18} (=6 fails)

@jkowalleck jkowalleck 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 Oct 23, 2022
@wraithgar
Copy link
Member

wraithgar commented Oct 26, 2022

The default behavior in npm9 is to install linked deps instead of creating symlinks. If you want your file: dependencies to be links you need to use --install-links=false. There does appear to be an issue with installing these linked deps still, but that flag should get your CI working again.

@jkowalleck
Copy link
Author

jkowalleck commented Oct 26, 2022

can confirm, worked with --install-links=false on my local site ind in CI/CT.
unexpected solution, but works.

@wraithgar wraithgar changed the title [BUG] local transitive dependencies cannot be installed [BUG] local transitive dependencies cannot be installed with --install-links=true Oct 26, 2022
@wraithgar wraithgar added Priority 1 high priority issue and removed Needs Triage needs review for next steps labels Oct 27, 2022
@jkowalleck
Copy link
Author

jkowalleck commented Oct 30, 2022

now that npm i --install-links=false worked, i see that npm ls had issues in the mentioned demo setup:

npm ERR! code ELSPROBLEMS
npm ERR! invalid: my-local-a@0.0.0 /.../cyclonedx-node-npm/demo/local-dependencies/project/node_modules/my-local-a
npm ERR! invalid: my-noname@0.0.0 /.../cyclonedx-node-npm/demo/local-dependencies/project/node_modules/my-noname
demo-local-deps@0.0.0 /.../cyclonedx-node-npm/demo/local-dependencies/project
├── my-local-a@0.0.0 invalid: "file:packages/my-local-a" from the root project -> ./packages/my-local-a
└── my-noname@0.0.0 invalid: "file:packages/my-noname" from the root project -> ./packages/my-noname

@wraithgar
Copy link
Member

npm ls needs to be called w/ the same flags as install in order for it to properly interpret a tree.

@lukekarrys lukekarrys added Priority 0 will get attention right away and removed Priority 1 high priority issue labels Nov 2, 2022
@lukekarrys lukekarrys self-assigned this Nov 2, 2022
@lukekarrys
Copy link
Contributor

A possible fix for this is being tracked in #5820.

@saquibkhan
Copy link
Contributor

saquibkhan commented Jan 19, 2023

as discussed with team , it seems this will require more effort on the fix and testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 0 will get attention right away Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

No branches or pull requests

5 participants