Eduard
Eduard

Reputation: 9165

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

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.

Upvotes: 6

Views: 9709

Answers (2)

Yodi S.
Yodi S.

Reputation: 118

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.

Upvotes: 4

Lead Developer
Lead Developer

Reputation: 1169

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.

Upvotes: 13

Related Questions