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

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.


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.

Tags:

Terminal

Npm