系统:Linux Fedora
在tauri打包时,运行npm run tauri build报该错误
搜索问题:github上的bug还在open阶段,自己尝试解决[bug] failed to bundle project: error running appimage.sh · Issue #5781 · tauri-apps/tauri · GitHub
问题定位:
运行npm run tauri build -- --verbose
查看到的日志,停留在
wget -q -4 -N https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
Error [tauri_cli_node] failed to bundle project: error running appimage.sh
运行
$ wget -v -4 -N https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh --2023-08-22 14:23:35-- https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 0.0.0.0 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|0.0.0.0|:443... failed: Connection refused.
所以定位为raw.githubusercontent.com连接不上的问题,经过搜索找到原因,为raw.githubusercontent.com的ip域名解析错误导致。
解决方法:
第一步:修改raw.githubusercontent.com对应的host
https://www.ipaddress.com这个网站中的查询框中输入:raw.githubusercontent.com,得到4个ip
打开hosts文件
sudo vim /etc/hosts
在文件中添加查询到的地址和域名:
185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
:wq保存退出
————————————————
注:应添加在第一行
第二步:修改DNS解析地址
vim /etc/resolv.conf
添加
nameserver 8.8.8.8
注:应添加在第一行
保存退出
检查是否生效:
运行 ping raw.githubusercontent.com 如解析出ip,而不是127.0.0.1,则已生效
再次运行npm run tauri build即可打包