Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # 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
test-npm@1.0.0 C:\git\test-npm
`-- (empty)

Expected Behavior

npm ls node-gyp-buid
test-npm@1.0.0 C:\git\test-npm
kafka-lz4-lite@1.0.5
    └─┬ piscina@3.2.0
      └─┬ nice-napi@1.0.2
        └── node-gyp-build@4.8.1

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             
test@1.0.0 /Users/milaninfy/workarea/rep/test
└─┬ kafka-lz4-lite@1.0.5
  └─┬ piscina@3.2.0
    └─┬ nice-napi@1.0.2
      └── node-gyp-build@4.8.1

~/workarea/rep/test $ npm ls node-gyp-build 
test@1.0.0 /Users/milaninfy/workarea/rep/test
└─┬ kafka-lz4-lite@1.0.5
  └─┬ piscina@3.2.0
    └─┬ nice-napi@1.0.2
      └── node-gyp-build@4.8.1

@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
# for free to join this conversation on GitHub. Already have an account? # 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