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

Already on GitHub? Sign in to your account

Reusable npm list format would be nice #2059

opichals opened this Issue Jan 19, 2012 · 8 comments


None yet
5 participants

Something one would be able to use like:

E.g. for name match package name processing

$ npm ls --short
$ npm ls --short | grep gdc\- | xargs npm uninstall

mfncooper commented Feb 5, 2012

I know this isn't really what you're looking for, but this will get you a space-separated list of (top-level) dependencies from the command line:

node -e "console.log(Object.keys(require('./package.json').dependencies).join(' '))"

opichals commented Feb 9, 2012

I was rather talking about something that one can easily grep on and send the resulting list to another command for further processing.

Examples of other package managers having similar functionality:

rpm -qa | grep apache
dpkg -l | grep apache

mfncooper commented Feb 9, 2012

Yes, I realise that. So perhaps newline-separated instead of space-separated. For example, if you are sitting in the express directory:

[express]$ node -e "console.log(Object.keys(require('./package.json').dependencies).join('\n'))"

which you could now pipe into grep if you choose.

You are still showing the 'dependencies' while my request and examples are talking about the list of installed packages.

+1 for the opichals idea. It's frustating having to scroll through all the dependencies everytime I want to see what's installed.

Maybe npm ls --compact?


luk- commented Mar 9, 2013

Why not just $ ls node_modules


luk- commented Mar 13, 2013

This would be a good feature for a module, not npm.

@luk- luk- closed this Mar 13, 2013


isaacs commented Mar 13, 2013

There's already --parseable, which is pretty awk/grep friendly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment