I am installing grunt, node, npm, bower, and grunt-cli on windows7.
The instructions say i should run the install commands with -g flag for global.
How can I check if I used the -g flag when i installed. It will take a lot of time to uninstall them and reinstall.
You can list all global packages with the command:
Or check for a specific package with:
For example:
npm ls -g @angular/cli
Use the
list
command with the-g
flag to see all packages that are installed globally:npm list -g
To check if a specific package is installed globally, you can provide the name of package (
grunt
in this case) as seen below:npm list -g grunt
Or you can use
grep
to filter on package names:npm list -g | grep grunt
Source: https://docs.npmjs.com/cli/ls
To check if a specific package is installed globally execute:
Let's take "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.
source: How to check if npm package was installed globally or locally.
You can then check the exit status to see if it's installed or not. Thanks Adam Monsen.