简体   繁体   中英

Can't install packages globally with npm

I can't install packages globally on windows. Every time I try npm install -g <pachage> it installs the package in the current(from where I run this command) folder and not in C:\\Users\\<user>\\AppData\\Roaming\\npm . Any idea? I am working on Windows 10 and with NVM.

You should use

npm install <package name> -g

for example

npm install jshint -g 

this should work fine. incase you get permission errors. trying to run your commandline as administrator.

If you are a linux user you should use

sudo npm install <package name > -g.

hope this works for you

enter image description here check this image and look carefully. if it doesnt work then perhaps you installed node wrongly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM