electron-vite打包出错

问题:1

electron-vite 安装, 打包下载资源失败,设置国内镜像

由于electron默认打包会从github上下载相关二进制包,众所周知,国内GitHub访问是相当慢的,所以经常会出现下载失败导致打包不成功,这时我们就需要配置国内的镜像源,以解决从GitHub下载慢甚至无法下载的问题。

修改npm配置文件(没有就创建):

npm的配置文件为用户根目录下的:~/.npmrc(Windows路径为:C:\Users<UserName>.npmrc)

加入以下内容:

prefix=/opt/node/global
cache=/opt/node/cache
registry=https://registry.npmmirror.com/
disturl=https://registry.npmmirror.com/-/binary/node/
sass_binary_site=https://registry.npmmirror.com/node-sass
phantomjs_cdnurl=https://registry.npmmirror.com/phantomjs
chromedriver_cdnurl=https://registry.npmmirror.com/-/binary/chromedriver/
operadriver_cdnurl=https://registry.npmmirror.com/-/binary/operadriver/
electron_mirror=https://registry.npmmirror.com/-/binary/electron/
electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/
always-auth=false

源地址:https://www.cnblogs.com/benbentu/p/17955151

问题2:

源地址:解决npm被墙问题 | furfur (furfur-jiang.github.io)

执行下面这行代码即可

npm config set registry http://registry.npm.taobao.org

查看npm配置信息 npm config list 看registry即可 如下即成功

 registry = "http://registry.npm.taobao.org/"
  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值