npm-set

在 npm 配置中设置一个值

选择命令行版本:

概要

🌐 Synopsis

npm set <key>=<value> [<key>=<value> ...] (See `npm config`)

注意:此命令不支持工作区。

🌐 Note: This command is unaware of workspaces.

描述

🌐 Description

在 npm 配置中设置一个值

🌐 Set a value in the npm configuration

配置

🌐 Configuration

global

  • 默认:否
  • 类型:布尔

以“全局”模式运行,因此软件包会安装到 prefix 文件夹中,而不是当前工作目录。有关行为差异的更多信息,请参见 folders

🌐 Operates in "global" mode, so that packages are installed into the prefix folder instead of the current working directory. See folders for more on the differences in behavior.

  • 软件包被安装到 {prefix}/lib/node_modules 文件夹中,而不是当前工作目录。
  • bin 文件与 {prefix}/bin 关联
  • 手册页已链接到 {prefix}/share/man

location

  • 默认值:除非传入 --global,否则为 "user",传入后该值也会设置为 "global"
  • 类型:“全局”、“用户”或“项目”

当传递给 npm config 时,这指的是使用哪个配置文件。

🌐 When passed to npm config this refers to which config file to use.

当设置为“全局”模式时,软件包会安装到 prefix 文件夹,而不是当前工作目录。有关行为差异的更多信息,请参见 文件夹

🌐 When set to "global" mode, packages are installed into the prefix folder instead of the current working directory. See folders for more on the differences in behavior.

  • 软件包被安装到 {prefix}/lib/node_modules 文件夹中,而不是当前工作目录。
  • bin 文件与 {prefix}/bin 关联
  • 手册页已链接到 {prefix}/share/man

也可以看看

🌐 See Also