How to check if npm package was installed globally or locally



This code snippet shows you how to check if npm package was installed globally or locally.

To check if a specific package is installed globally execute:

Let’s take package “grunt” as an example.
If it is installed globally, you should see something like this

If it is not installed globally, you should see something like this

To check if a specific package is installed locally you can execute the same commands as above but without the -g parameter.