npm使用淘宝镜像安装包

npm使用registry这个属性指定仓库,因此配置这个属性即可。修改npm配置属性的几种方法详见官方文档

这里只贴出修改registry的方法,以下三种任意一种即可:

  • 修改~/.npmrc文件(没有就自行新建一个),写入registry = https://registry.npm.taobao.org
  • 使用命令npm config set registry https://registry.npm.taobao.org(效果和上面等效)
  • 添加环境变量NPM_CONFIG_REGISTRY=https://registry.npm.taobao.org

同样的方法,将disturl这个配置同样指向: https://npm.taobao.org/dist, 任选一种方案:

npm config set disturl https://npm.taobao.org/dist

node-sass/phantomjs/electron使用淘宝镜像站

有些软件包安装的时候会下载已预编译好的二进制格式,比如node-sass/phantomjs/electron等等,这几个软件包大多数都将编译好的成品托管在S3上。

比较幸运的是这些软件包都有办法指定下载的路径,有兴趣的可以自己去读这些包的安装代码,会去从环境变量或npmrc配置中读取下载的路径,这里只贴出npmrc方案。同样也适用于npm环境变量配置方案:

npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/

原文地址:https://www.cnblogs.com/nodegis/p/9721479.html

时间: 2024-08-06 06:08:47

npm使用淘宝镜像安装包的相关文章

nodeJS安装及npm设置淘宝镜像

nodeJS安装及npm设置淘宝镜像 node.js安装 下载node.js安装包:https://nodejs.org/en/download/,下载相应版本的node.js. 需注意,在window中,node的安装目录中,最好不要有空格或中文字符. nodeJS的资源仓库在国内使用过程中,偶尔会遇到各种资源问题,通常设置为淘宝的镜像,网上很多说法是安装淘宝镜像,即 $ npm install -g cnpm --registry=https://registry.npm.taobao.or

npm 国内淘宝镜像cnpm

某些插件很奇怪,需要用国内的镜像下载才可以 #安装淘宝镜像npm install cnpm -g --registry=https://registry.npm.taobao.org #使用淘宝镜像下载才可以使用cnpm install gulp-uglify --save-dev

npm切换淘宝镜像

查看当前镜像地址: npm get registry 切换为淘宝镜像: npm config set registry http://registry.npm.taobao.org/ 切换为原本的npm镜像: npm config set registry https://registry.npmjs.org/

npm 安装淘宝镜像

安装node win+r输入cnd打开命令行:node(ctrl+c退出) 安装npm,命令行输入: npm 检测版本号: node-v npm-v 安装淘宝镜像:npm install -g cnpm --registry=https://registry.npm.taobao.org 在命令行用cnpm代替npm安装难下载的包或软件,比如 cnpm install browser-sync -g 原文地址:https://www.cnblogs.com/tutumissed/p/827619

npm 使用淘宝镜像

1. npm临时使用淘宝镜像安装依赖包 npm i -g express --registry https://registry.npm.taobao.org 2.npm持久使用淘宝镜像安装依赖包 npm config set registry https://registry.npm.taobao.org npm i -g express 3. cnpm 使用 安装cnpm npm i -g cnpm --registry=https://registry.npm.taobao.org安装插件

npm添加淘宝镜像

npm是一个很好用的工具,全场是Node Packet Manager,是一个nodejs的包管理工具,但是美中不足的是当我们去安转包的时候却发现下载的速度太慢,但是没关系,还是有方法的就是利用淘宝的国内镜像,一下是3个设置的方法: 镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在): 1.通过config命令 npm config set registry https://registry.npm.taobao.org npm info unders

npm 切换淘宝镜像几种方式

淘宝 npm 地址: http://npm.taobao.org/ 如何使用 有很多方法来配置npm的registry地址,下面根据不同情境列出几种比较常用的方法.以淘宝npm镜像举例: 1.临时使用 npm --registry https://registry.npm.taobao.org install express 2.持久使用 npm config set registry https://registry.npm.taobao.org 配置后可通过下面方式来验证是否成功 npm c

npm切换淘宝镜像源

npm 切换到淘宝源地址默认的npm下载地址:http://www.npmjs.org/淘宝npm镜像的地址:https://npm.taobao.org/ 临时使用淘宝源npm --registry https://registry.npm.taobao.org install [email protected] 全局配置切换到淘宝源npm config set registry https://registry.npm.taobao.org 全局配置切换到官方源npm config set

【npm】使用NPM / 淘宝镜像

一.切换NPM仓库地址 二.使用淘宝镜像