rmdir.cn

npm config

管理 npm 配置

语法

npm config <子命令> [选项]

说明

npm config 命令用于查看和修改 npm 的配置项(如 registry、cache 目录等)。

参数

  • get

    读取配置项

  • set

    设置配置项

  • list

    列出所有配置

  • delete

    删除配置项

  • -g

    操作全局配置

示例

查看 registry

查看当前使用的镜像源

npm config get registry

切换到淘宝镜像

临时切换到国内镜像加速

npm config set registry https://registry.npmmirror.com

列出配置

显示所有生效的配置项

npm config list