npm 命令键全局安装包

npm command key to install package globally

我正在尝试在 OS X 上全局安装 gulp,但我注意到一件奇怪的事情,我想了解一下。首先我尝试了以下命令:

npm install -g glup

导致以下错误:

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:

但是当我这样尝试时:

npm install --global gulp

命令成功。

所以,我想了解一下-g--global有什么区别。我看过其他答案,但所有答案都是一样的。如果两个键都可以互换,那么为什么会有不同的结果?

'glup' is not in the npm registry.

您似乎在 npm 上键入了 glup 而不是 gulpglup doesn't exist。这只是一个错字。 -g--global 之间应该没有区别。