How to tell if npm package was installed globally or locally

后端 未结 6 1302
遇见更好的自我
遇见更好的自我 2020-12-22 17:25

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

6条回答
  •  独厮守ぢ
    2020-12-22 17:48

    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

    C:\data\tryout\test1>npm list -g grunt
    C:\Users\xxxxxxx\AppData\Roaming\npm
    └── grunt@0.4.5
    

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

    C:\data\tryout\test1>npm list -g grunt
    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.

提交回复
热议问题