npm使用国内淘宝镜像(最新地址)
warning:
这篇文章距离上次修改已过451天,其中的内容可能已经有所变动。
自npm v5起,可以通过配置使用淘宝镜像。以下是配置淘宝镜像的步骤:
- 临时使用淘宝镜像:
npm --registry https://registry.npm.taobao.org install express- 永久配置:
npm config set registry https://registry.npm.taobao.org通过
.npmrc文件配置:在项目的根目录或用户的主目录中添加或编辑
.npmrc文件,添加以下内容:
registry=https://registry.npm.taobao.org使用
nrm工具管理npm源:首先安装
nrm:
npm install -g nrm然后使用nrm切换到淘宝镜像:
nrm use taobao以上步骤均可将npm配置为使用淘宝镜像,从而加速npm包的安装过程。
评论已关闭