注意

如果开发 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. DIANA算法

    DIANA算法 DIANA算法示例 DIANA算法练习

  2. int 越界处理

    在程序运行中,如果运算结果太大超出了所定义的类型,那么可能会影响整个程序的运行结果,甚至是程序出错. 因此,在编写程序时,加入越界处理就显得一起重要了. 用整型 int 来举个例子吧,int型占四个字 ...

  3. 15_伯德图,为什么是20logM?分贝又是什么?_Bode Plot_Part1

  4. html5不熟悉的标签全称

    <dl></dl> 定义列表(英文全称:DefinitionList) <dt> 放在每个定义术语词前(定义术语.英文全称:DefinitionTerm) 名称 & ...

  5. 【uniapp 开发】日期工具类 -- DateUtil

    日期格式转毫秒值 var time = '2019-08-08 12:09:34'; var time222 = time.replace("-", "/"). ...

  6. metasploit基本命令

    一.核心命令 ? 帮助命令 banner 显示一个真棒metasploite横幅 cd 更改当前的工作目 color 切换颜色 connect 连接与主机通信 exit 退出控制台 get 获取特定于 ...

  7. 在Vue3项目中使用pinia代替Vuex进行数据存储

    pinia是一个vue的状态存储库,你可以使用它来存储.共享一些跨组件或者页面的数据,使用起来和vuex非常类似.pina相对Vuex来说,更好的ts支持和代码自动补全功能.本篇随笔介绍pinia的基 ...

  8. Go xmas2020 学习笔记 09、Closures

    09-Closures.闭包是一种函数,调用具有来自函数外部的附加数据.闭包内的额外数据是引用封闭的

  9. AcWing周赛44

    周赛44 4317. 不同正整数的个数 link:https://www.acwing.com/problem/content/4320/ 我直接set #include <iostream&g ...

  10. JQuery学习高级

    ## 今日内容:     1. JQuery 高级         1. 动画         2. 遍历         3. 事件绑定         4. 案例         5. 插件 ## ...