简体   繁体   English

无法使用npm全局安装软件包

[英]Can't install packages globally with npm

I can't install packages globally on windows. 我无法在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 . 每次尝试npm install -g <pachage>它将软件包安装在当前(运行此命令的位置)文件夹中,而不是C:\\Users\\<user>\\AppData\\Roaming\\npm Any idea? 任何想法? I am working on Windows 10 and with NVM. 我正在Windows 10和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 如果您是Linux用户,则应使用

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 如果它不起作用,那么您可能错误地安装了节点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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