注意

如果开发 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. 网络协议之:socket协议详解之Socket和Stream Socket

    目录 简介 Socket是什么 Stream Socket 使用socat创建一个TCP服务器 使用ss检查TCP连接 使用nc连接socket 总结 简介 不管是在普通的网络编程中还是在netty中 ...

  2. 遇到的错误之“Cannot find module 'XXX’的错误”

    一.问题: 在进行webpack打包的时候,会出现Cannot find module 'XXX'的错误,找不到某个模块的错误 二.解决方法: (1)方法1: 直接进行npm install重新打包: ...

  3. AD中PCB各层的含义

    PCB的各层定义及描述: 1. Top Layer(顶层布线层):设计为顶层铜箔走线.如为单面板则没有该层. 2. Bottom Layer(底层布线层):设计为底层铜箔走线. 3. Top/Bott ...

  4. ubantu之Git使用

    本文讲述在Ubuntu 14.04 x64环境下,如何安装Git,配置连接GitHub,并且上传本地代码到github. 一. 注册Git账户以及创建仓库 要想使用github第一步当然是注册gith ...

  5. audio小记

    写H5活动页的需要音频,图标旋转停止保持当时的旋转角度,这样视觉体验效果好: 之前写法是点击pause()就直接停止动画,后来发现了animation有个比较好的属性animation-play-st ...

  6. 在 Mac 上开发 .NET MAUI

    .NET 多平台应用程序 UI (.NET MAUI) 是一个跨平台框架,用于使用 C# 和 XAML 创建本机移动和桌面应用程序,这些应用程序可以从单个共享代码库在 Android.iOS.macO ...

  7. 火狐浏览器Hackbar安装破解

    1 下载 https://pan.baidu.com/s/18cKoJAam9by7AB168Im57g 64mt 下载后解压到一个固定文件夹下 2 安装 选择xpi进行安装 3 关闭插件更新 点击插 ...

  8. redis的基础命令操作

    文章目录 前言 一.字符串类型 二.哈希类型 三.列表类型 四.集合类型 五.有序集合类型 六.通过命令 前言 redis的数据结构 redis存储的是key,value格式的数据,其中的key是字符 ...

  9. npm 和 Yarn 镜像站配置

    Node.js 作为近年来非常受欢迎的 Web 开发运行环境,由于开发者众多,贡献开源代码的人也很多,所有这些凝结成了 npm 这个世界上最大的软件包仓库,但是受限于 npm 软件包的服务器在国外,国 ...

  10. oracle各种用户登录的方式

    Oracle有3种用户: system.sys.scott 1.system和sys的差别在与是否能创建数据库2.sys用户登录创建数据库,3.scott是给刚開始学习的人学习的用户.学习者能够用Sc ...