精通 npm config list | AI生成和翻译

Home 2026.02

我将详细解释 npm config list 命令及其用法。

Basic Usage

npm config list

此命令显示你当前的 npm configuration 设置。它会展示:

Common Variations

仅列出用户和 global 设置(不包含 defaults):

npm config list --json

以 JSON 格式列出以便于解析:

npm config list -l

显示所有 config 选项,包括 defaults:

npm config list -l

What You’ll See

输出通常包含如下设置:

获取特定的 config 值:

npm config get registry

设置一个 config 值:

npm config set registry https://registry.npmjs.org/

删除一个 config 值:

npm config delete proxy

在默认编辑器中编辑 config:

npm config edit

该命令对于调试 npm 问题、检查 registry 设置或验证 authentication configuration 非常有用。


Back Donate