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] Can not get npm ls to show origin of an optional dependency #7532

Closed
2 tasks done
inwenis opened this issue May 15, 2024 · 4 comments
Closed
2 tasks done

[BUG] Can not get npm ls to show origin of an optional dependency #7532

inwenis opened this issue May 15, 2024 · 4 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@inwenis
Copy link

inwenis commented May 15, 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

npm ls node-gyp-build
[email protected] C:\git\test-npm
`-- (empty)

Expected Behavior

npm ls node-gyp-buid
[email protected] C:\git\test-npm
[email protected]
    └─┬ [email protected]
      └─┬ [email protected]
        └── [email protected]

Steps To Reproduce

npm init -y
npm install kafka-lz4-lite@latest
npm ls node-gyp-buid
npm ls --all node-gyp-buid
npm ls --include=optional node-gyp-buid

Environment

  • npm: 10.7.0
  • Node.js: v22.0.0
  • OS Name: win
  • System Model Name:
  • npm config:
; "user" config from ...

msbuild_path = "c:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe"
msvs_version = "2017"

; node bin location = C:\programki\nodejs\node.exe
; node version = v22.0.0
; npm local prefix = C:\git\test-npm
; npm version = 10.7.0
; cwd = C:\git\test-npm
; HOME = ...
; Run `npm config ls -l` to show all defaults.
@inwenis inwenis added Bug thing that needs fixing Needs Triage needs review for next steps labels May 15, 2024
@wraithgar
Copy link
Member

Is the dependency actually installed? npm ls will only show the packages that are actually installed.

@inwenis
Copy link
Author

inwenis commented May 18, 2024

thank you for the reply @wraithgar
The pacakge I'm looking for is not present in node_modules.
Is there a way to analyse the deprendency tree including optional deps?

@milaninfy
Copy link
Contributor

@inwenis I think you meant npm ls node-gyp-build and not npm ls node-gyp-buid

This is my output from the steps you mentioned on 10.8.1, looks correct for me.

~/workarea/rep/test $ npm ls --all node-gyp-build             
[email protected] /Users/milaninfy/workarea/rep/test
└─┬ [email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └── [email protected]

~/workarea/rep/test $ npm ls node-gyp-build 
[email protected] /Users/milaninfy/workarea/rep/test
└─┬ [email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └── [email protected]

@inwenis
Copy link
Author

inwenis commented Jul 1, 2024

@milaninfy you're right a made a typo however you're getting the dependency tree cuz you're on linux, my issue is that I ran it on windows

@inwenis inwenis closed this as completed Jul 1, 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

3 participants