npm / cli

the package manager for JavaScript

Home Page:https://docs.npmjs.com/cli/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

inwenis opened this issue · comments

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-buid
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.
commented

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