cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] `npm ls --dev` does not show only dev dependencies

Open Or-Geva opened this issue 3 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

This issue exists in the latest npm version

  • [X] I am using the latest npm

Current Behavior

No response

Expected Behavior

No response

Steps To Reproduce

No response

Environment

  • npm:8.11.0
  • Node.js:16.15.1
  • OS Name:macOS Monterey Version 12.4

Or-Geva avatar Jun 27 '22 14:06 Or-Geva

--dev is no longer a configuration option, and so no filtering will occur. [email protected] is the latest, not 8.11.0

As far as the suggested --include=dev, the documentation is unclear, especially in the context of npm ls. For npm install, the documentation states inverse behavior from --omit, so we should expect that in npm ls and we should clarify the docs.

fritzy avatar Jun 28 '22 23:06 fritzy

@fritzy, thanks for your response. I have tried both npm ls --indluce=dev and npm ls --omit=prod, but again, the output includes production dependencies. Would it be possible to get only dev dependencies using the command npm ls like I used to? (I used to run npm ls --dev with npm v6/7).

Or-Geva avatar Jun 29 '22 06:06 Or-Geva

I second this. npm ls --omit=prod to list only dev-dependencies

rocktimsaikia avatar Oct 25 '22 05:10 rocktimsaikia

user@machine:~/DEV/api$ npm ls --omit=prod
npm WARN invalid config omit="prod" set in command line options
npm WARN invalid config Must be one or more of: dev, optional, peer

I'm using node v16.18.1 with npm v8.19.2

cedricmillet avatar Dec 02 '22 10:12 cedricmillet