Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm list only dev or prod depedencies

Tags:

javascript

npm

I am trying to ls only the production dependencies from package.json following the docs

So I am doing

npm list -depth 0 -prod

or

npm list -depth 0 -only prod

enter image description here

But npm seems to ignore it and it lists both dependencies and devDependencies

Any idea how I can achieve that?

like image 922
Avraam Mavridis Avatar asked Apr 24 '16 17:04

Avraam Mavridis


2 Answers

I found out that the command is not supported on 3.7.3 so I updated my npm version to 3.8.7 and the following command does the job

npm list -prod -depth 0

like image 68
Avraam Mavridis Avatar answered Oct 02 '22 21:10

Avraam Mavridis


npm list -depth 0 -prod true Lists the dependencies and npm list -depth 0 -dev true lists the devDependencies. Those work for me. You are missing the true after the -prod or -dev flag.

like image 35
Snekw Avatar answered Oct 02 '22 20:10

Snekw