electron-vite打包出错

electron-vite打包出错_第1张图片

问题:1

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

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

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

npm的配置文件为用户根目录下的:~/.npmrc(Windows路径为:C:\Users.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/"

你可能感兴趣的:(electron,javascript,前端)