注意

如果开发 electron 桌面软件,需要设置以下两个镜像地址

disturlelectron_mirror

如果用到了 node-sass 需要设置以下一个镜像地址

sass_binary_site

yarn

yarn config set registry https://registry.npm.taobao.org -g &&
yarn config set disturl https://npm.taobao.org/dist -g &&
yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g &&
yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g &&
yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g

npm

npm config set registry https://registry.npm.taobao.org &&
npm config set disturl https://npm.taobao.org/dist &&
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/

备注

此方案可以完美解决 electron 项目在 ubuntu 下安装依赖、打包报错的问题,其他 os 也可配置上述地址来加速前端项目安装、打包过程,不限于 electron 项目

node-sass 只能使用 node 15 以下的版本,推荐 node 14.x

其他配置

yarn/npm 设置镜像地址的更多相关文章

  1. Yarn && npm设置镜像源

    安装yarn npm i -g yarn yarn yarn config set registry https://registry.npm.taobao.org --global yarn con ...

  2. npm的nrm命令使用--设置镜像地址

    npm下载会很慢,因为npm默认从国外下载资源,建议修改npm镜像源地址 1.运行npm i nrm -g全局安装nrm包: 2.使用nrm ls查看当前所有可用的镜像源地址以及当前所使用的镜像源地址 ...

  3. yarn 切换 设置 镜像 源

    1.查看一下当前源 yarn config get registry 2.切换为淘宝源 yarn config set registry https://registry.npm.taobao.org ...

  4. maven设置镜像地址

    方法一:在maven文件夹下的settings.xml中添加(对所有的项目都有效) <mirror> <id>alimaven</id> <name>a ...

  5. yarn (npm) 切换设置镜像源

    设置镜像源 1.查看一下当前源 yarn config get registry 2.切换为淘宝源 yarn config set registry https://registry.npm.taob ...

  6. npm设置为淘宝镜像地址

    1. npm设置为淘宝镜像 $npm config set registry https://registry.npm.taobao.org 2. 检查一下 $npm config get regis ...

  7. npm和yarn设置镜像源

    npm 设置为淘宝源 npm config set registry https://registry.npm.taobao.org 使用nrm管理 nrm: npm registry manage ...

  8. npm 设置地址

    -- 查看当前地址: npm config get registry https://registry.npmjs.org/ npm config get disturl undefined -- 设 ...

  9. 设置npm的镜像源

    将npm的镜像源设置为淘宝镜像源 1.执行命令修改镜像源地址:npm config set registry https://registry.npm.taobao.org 2.重新加载修改后的地址: ...

随机推荐

  1. Failed to write HTTP message,Could not write JSON错误

    今天遇到使用@ResponseBody注解返回json数据时报错 Failed to write HTTP message: org.springframework.http.converter.Ht ...

  2. 解决Project出来的问题

    问题显现: 解决办法: 恢复默认布局

  3. cpu指令如何读写硬盘

    我们提到cpu的主要作用之一就是控制设备之间的数据交互.这其中自然也包括了硬盘.系统的所有数据基本都在硬盘中,所以知道怎么读写硬盘,对程序来说非常重要,所以我们先来探索下传说中的pio模式. cpu要 ...

  4. 利用Matlab快速绘制栅格地图

    代码演示 % 基于栅格地图的机器人路径规划算法 % 第1节:利用Matlab快速绘制栅格地图 clc clear close all %% 构建颜色MAP图 cmap = [1 1 1; ... % ...

  5. 论文阅读-Clustering temporal disease networks to assist clinical decision support systems in visual analytics of comorbidity progression

    一.问题描述:      二.相关工作: 三.方法描述: 四.实验及结果

  6. MySQL外键约束On Delete和On Update的使用

    On Delete和On Update都有Restrict,No Action, Cascade,Set Null属性.现在分别对他们的属性含义做个解释. ON DELETE restrict(约束) ...

  7. 微信h5静默和非静默授权获取用户openId和用户信息的方法和步骤:

    原文链接:https://blog.csdn.net/qq_35430000/article/details/79299529 一.openId是什么?openId是用户在当前公众号下的唯一标识('身 ...

  8. springboot+springsecurity+mybatis plus之用户授权

    文章目录 前言 一.导入坐标 二.Users实体类及其数据库表的创建 三.controller,service,mapper层的实现 四.核心--编写配置文件 五.无权限界面和登录界面的实现 前言 即 ...

  9. Springboot集成cache的key生成策略

    代码接上文:深度理解springboot集成redis缓存之源码解析 ## 1.使用SpEL表达式 @Cacheable(cacheNames = "emp",key = &quo ...

  10. 检查oracle是否是rac

    采样rac集群 [root@shfpdb02 disks]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.4 ( ...