npm install -g *无参数*

npm install -g *no arguments*

命令 npm install -g(无参数)有什么作用?我打开了 npm 文档,但没有得到它:

In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package.

这是什么意思?

这意味着无论当前在哪个项目中,npm 都会从当前项目文件夹中的 package.json 中获取依赖项,然后全局安装这些依赖项。