npm / npm/cli

[BUG] npm ls only listing dev dependencies by default

Open
#7,917 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug cmd:list Priority 2
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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 running npm ls INSERT_DEPENDENCY I am only getting back those installation underneath the dev dependencies.

If I run npm ls --prod INSERT_DEPENDENCY then I can see the missing dependency.

Expected Behavior

I would expect that npm ls INSERT_DEPENDENCY by default would list both dev and production dependencies.

Steps To Reproduce

minimal repro

Environment
  • npm: 10.9.0
  • Node.js: 22.11.0
  • OS Name: MacOS
  • System Model Name: MacBook Pro M1
  • npm config:
; copy and paste output from `npm config ls` here
; node bin location = /Users/sethtomy/.nvm/versions/node/v22.11.0/bin/node
; node version = v22.11.0
; npm local prefix = /Users/sethtomy/Developer/open-source/minimal-reproduction-repos/npm-ls-issue
; npm version = 10.9.0
; cwd = /Users/sethtomy/Developer/open-source/minimal-reproduction-repos/npm-ls-issue
; HOME = /Users/sethtomy
; Run `npm config ls -l` to show all defaults.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproduction at github.com/sethtomy/npm-ls-issue-repro and run npm ls INSERT_DEPENDENCY with npm 10.9.0, then compare it with npm ls --prod INSERT_DEPENDENCY. Done means the default command lists matching dependencies from both development and production installations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.