简体   繁体   English

npm命令键以全局安装软件包

[英]npm command key to install package globally

I am trying to install gulp on OS X globally but I have noticed a strange thing which I want to understand. 我正在尝试在OS X上全局安装gulp,但我注意到我想了解的一件奇怪的事情。 First I tried the following command: 首先,我尝试了以下命令:

npm install -g glup

Which resulted in the following error: 导致以下错误:

npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "glup"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/glup
npm ERR! 404 
npm ERR! 404 'glup' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:

But when I tried it this way: 但是当我这样尝试时:

npm install --global gulp

the command has succeeded. 命令成功。

So, I want to understand what is the difference between -g and --global . 因此,我想了解-g--global之间的区别。 I have seen other answers but all of them are the same. 我看到了其他答案,但所有答案都是相同的。 If both keys are interchangeable then why different results? 如果两个键可以互换,那么为什么会有不同的结果?

'glup' is not in the npm registry. 'glup'不在npm注册表中。

You seem to have typed glup instead of gulp , and glup doesn't exist on npm. 你似乎已经输入glup代替gulp ,并glup不存在的NPM。 It was just a typo. 这只是一个错字。 There should be no difference between -g and --global . -g--global之间应该没有区别。

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

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