华为NPM 镜像
2025-09-21 04:33:14

NPM 镜像

您可以移步 https://mirrors.huaweicloud.com/home 查看是否有版本更新。

依赖管理工具选择依赖管理工具

NPM

准备工作

使用前,请确保您已经安装 node.js(或 io.js)和 npm,如果您尚未安装,请参考以下方式加速下载安装。

方式一:手动安装

镜像站提供 nodejs,iojs,npm 的镜像地址分别如下所示,你可以手动下载对应的软件包进行安装。

node.js 加速地址:https://repo.huaweicloud.com/nodejs/

io.js 加速地址:https://repo.huaweicloud.com/iojs/

npm 加速地址:https://repo.huaweicloud.com/npm-software/

方式二:使用 nvm 安装

首先请参考此处(https://github.com/creationix/nvm)安装 nvm,然后执行如下命令安装对应的版本:

NVM_NODEJS_ORG_MIRROR=https://repo.huaweicloud.com/nodejs/ nvm install 4
NVM_IOJS_ORG_MIRROR=https://repo.huaweicloud.com/iojs/ nvm install 2

方式三:使用 nvmw 安装

首先请参考此处(https://github.com/hakobera/nvmw)安装 nvmw,然后执行如下命令安装对应的版本:

set "NVMW_NODEJS_ORG_MIRROR=https://repo.huaweicloud.com/nodejs/"
set "NVMW_IOJS_ORG_MIRROR=https://repo.huaweicloud.com/iojs/"
set "NVMW_NPM_MIRROR=https://repo.huaweicloud.com/npm-software/"
nvmw install node-v0.12.2
nvmw install iojs-v1.6.3

设置 registry 地址

通过如下命令设置华为镜像站的 npm 源,更详细的配置说明请点击此处。

npm config set registry https://repo.huaweicloud.com/repository/npm/

相关网址

NPM 官方地址:https://www.npmjs.com

nodejs 地址:https://nodejs.org/en

io.js 官方地址:https://iojs.org/zh

使用说明

npm 的配置文件为用户根目录下的:~/.npmrc(Windows 路径为:C:\Users\.npmrc),您可以点击此处直接下载配置文件,或者运行如下命令设置:

npm config set registry https://repo.huaweicloud.com/repository/npm/
npm cache clean -f

华为开源镜像站同时也提供了工具类加速镜像,可以通过如下的命令设置加速地址:

※ 设置 nodejs 工具的镜像地址

npm config set disturl https://repo.huaweicloud.com/nodejs

※ 设置 Node-Sass 的镜像地址

npm config set sass_binary_site https://repo.huaweicloud.com/node-sass

※ 设置浏览器引擎驱动镜像地址,如果需要安装 Selenium,请点击

https://repo.huaweicloud.com/selenium/

npm config set phantomjs_cdnurl https://repo.huaweicloud.com/phantomjs

npm config set chromedriver_cdnurl https://repo.huaweicloud.com/chromedriver

npm config set operadriver_cdnurl https://repo.huaweicloud.com/operadriver

※ 设置 Electron 和 Python 的镜像地址

npm config set electron_mirror https://repo.huaweicloud.com/electron/

npm config set python_mirror https://repo.huaweicloud.com/python

相关网址

npm 官方地址:https://www.npmjs.com

npm 文档地址:https://docs.npmjs.com

nodejs 地址:https://nodejs.org/en

io.js 官方地址:https://iojs.org/zh

Python 官方地址:https://www.python.org/

Electron 官方地址:https://electronjs.org/

phantomJS 官方地址:http://phantomjs.org/

Node-Sass 官方地址:https://github.com/sass/node-sass

Selenium 官方地址:https://www.seleniumhq.org/

依赖管理工具

选择依赖管理工具

Yarn

准备工作

使用前,请确保您已经安装 Node.js 和 yarn。如果您尚未安装,可以点击下面链接加速下载安装:

Node.js 加速下载地址:https://repo.huaweicloud.com/nodejs/

yarn 加速下载地址:https://repo.huaweicloud.com/yarn/

使用说明

yarn 的配置文件为用户根目录下的:~/.yarnrc(Windows 路径为:C:\Users\.yarnrc),可执行如下命令设置镜像源:

yarn config set registry https://repo.huaweicloud.com/repository/npm/

相关网址

yarn 官方地址:https://yarnpkg.com/yarn

文档地址:https://yarnpkg.com/zh-Hans/docs/

Node-Sass 镜像

您可以移步 https://mirrors.huaweicloud.com/home 查看是否有版本更新。

手动安装
node-sass 的镜像地址为:https://repo.huaweicloud.com/node-sass/,手动下载请访问该地址。

使用 npm 安装
npm config set sass_binary_site https://repo.huaweicloud.com/node-sass/


npm install node-sass

相关网址
Node-Sass 官方地址:https://github.com/sass/node-sass


NPM 官方地址:https://www.npmjs.com