To check if a specific package is installed globally, execute:
npm list -g [package-name]
Let's take Grunt as an example. If it is installed globally, you should see something like this:
npm list -g grunt
Output:
C:\Users\xxxxxxx\AppData\Roaming\npm
└── grunt@0.4.5
If it is not installed globally, you should see something like this
npm list -g grunt
Output:
C:\Users\xxxxxxx\AppData\Roaming\npm
└── (empty)
To check if a specific package is installed locally you can execute the same commands as above, but without the -g parameter.
Source: How to check if npm package was installed globally or locally.