注意

如果开发 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. Python学习--21天Python基础学习之旅(Day01、Day02)

    21天的python基础学习,使用<Python从入门到实践>,并且需要手敲书中的code,以下为整个学习过程的记录. Day01: 安装python时要选择复选框 Add Python ...

  2. ctfhub rce 命令注入 过滤cat 过滤空格 过滤目录分隔符

    命令注入 源码直接给了出来尝试127.0.0.1;ls 发现一串数字的php文件cat查看 127.0.0.1|cat 233382768628619.php 查看源码发现flag 过滤cat 这题和 ...

  3. pydev+eclipse写python代码

    首先,下载pydev:PyDev for Eclipse - Browse /pydev at SourceForge.net (建议下载到本地,之前看其他文章时,进行了如下安装: 启动 Eclips ...

  4. JAVA对XML文件的读写

    XML 指可扩展标记语言(EXtensible Markup Language),是独立于软件和硬件的信息传输工具,应用于 web 开发的许多方面,常用于简化数据的存储和共享. xml指令处理指令,简 ...

  5. vue日历(纯 js,没用任何插件和组件)

    效果图: 代码:   <template> <div class="calender"> <div class="top"> ...

  6. [MySQL]IP处理函数inet_aton()和inet_ntoa()

    INET_ATON(expr) 给出一个作为字符串的网络地址的"点地址"(如127.0.0.1)表示,返回一个代表该地址数值的整数.地址可以是4或8比特地址. mysql> ...

  7. 适配手机端rpx像素

    <script src="static/js/adaptive.js"></script> <script type="text/javas ...

  8. 使用babel编译器将es6代码转为es5的方法

    1.首先需要安装工具 babel-cli =========  npm i babel-cli -g   install 可以使用i 代替 2.安装插件   npm i --save-dev babe ...

  9. Vue报错Cannot read property 'split' of undefined

    今天在项目中处理后端返回的字符串需要使用split做一个字符串转数组的处理,之前项目都运行得好好的,今天突然出问题了,然后面向百度编程了一波,如果你也是用的异步向后端发送请求,可能你的问题和我一样,继 ...

  10. 前台js发请求参数与后台接参数的问题

    js函数中写参数,ajax中写参数,示例如下: function informationQuery(sign){//预警详情条件查询 $.get("/detail/informationQu ...