Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if npm package is installed in package.json through terminal

Tags:

terminal

npm

I am trying to find a way to check if a particular package is installed in my project through terminal. Is there a command for that? Something like npm check redux.

like image 498
Eduard Avatar asked Dec 27 '17 19:12

Eduard


2 Answers

you can check easily for that. this will describe all the package installed globally

npm list -g --depth=0

this will describe all the package installed locally on your project.

npm list --depth=0

if you want to check for a particular module is installed or not. Please use the following command in project folder. if installed, will display package name and version installed. if not installed, then will not display anything.

npm list --depth=0 | grep <module_name>

for more detail information please see this link. Click here for more info of your question

--depth=0 is necessary so that your terminal isn't flooded with package dependencies. if you are not use this option, you will see the all the dependencies tree.

like image 183
Lead Developer Avatar answered Sep 30 '22 10:09

Lead Developer


If you are searching for specific package installed in your project, you can use one of the commands below based on what kind of terminal you use. If you are using Unix shell based terminal, you can use:

npm list --depth=0 | grep <module_name> 

or if you're using windows terminal or power shell, you can use:

npm list --depth=0 | findstr <module_name>

findstr is a similar command like grep in unix shell.

like image 38
Yodi S. Avatar answered Sep 30 '22 10:09

Yodi S.