This question already has an answer here:
这个问题在这里已有答案:
- How do I install a module globally using npm? 6 answers
如何使用npm全局安装模块? 6个答案
I want to make a npm package and can be installed as global,but when i publish a package,it can't be used in global,what should i do ?
我想制作一个npm包,可以作为全局安装,但是当我发布一个包时,它不能在全局使用,我该怎么办?
I clone grunt-cli from github,I just want to test whether it can be installed in global,but i failed. What should i do?
我从github克隆grunt-cli,我只想测试它是否可以在全局安装,但我失败了。我该怎么办?
1 个解决方案
#1
To install a package as a global package you need to run npm install -g packagename
.
要将软件包安装为全局软件包,您需要运行npm install -g packagename。
On Mac and Linux you need to run sudo npm install -g packagename
.
在Mac和Linux上,您需要运行sudo npm install -g packagename。
#1
To install a package as a global package you need to run npm install -g packagename
.
要将软件包安装为全局软件包,您需要运行npm install -g packagename。
On Mac and Linux you need to run sudo npm install -g packagename
.
在Mac和Linux上,您需要运行sudo npm install -g packagename。