Tauri failed to bundle project: error running appimage.sh问题处理

系统: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即可打包

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Tauri 中,`App::handle`、`tauri::Builder::default()` 和 `tauri::WindowBuilder::new` 是三个重要的 API,它们分别用于处理应用程序的事件、构建 Tauri 应用程序和创建窗口。 ### App::handle `App::handle` 方法用于处理 Tauri 应用程序的事件。Tauri 是一个基于 Rust 和 Web 技术栈的框架,运行在基于 Chromium 内核的 WebView 中。`App::handle` 方法会监听应用程序的事件,例如启动、关闭、最小化、最大化等,并且可以根据这些事件来执行相应的操作。 以下是一个简单的示例,使用 `App::handle` 方法监听应用程序的启动事件,并在启动时打印一条消息: ```rust fn main() { tauri::Builder::default() .invoke_handler(tauri::generate_handler![my_custom_handler]) .run(tauri::generate_context!()) .expect("failed to run app"); } #[tauri::command] fn my_custom_handler() { println!("My Tauri app has started!"); } ``` ### tauri::Builder::default() `tauri::Builder::default()` 方法用于构建 Tauri 应用程序。在构建 Tauri 应用程序时,可以定义应用程序的窗口、菜单、打印机、文件选择器等属性。使用 `tauri::Builder::default()` 方法可以获取一个默认的构建器实例,你可以在此基础上进行进一步的配置。 以下是一个简单的示例,使用 `tauri::Builder::default()` 方法构建一个窗口: ```rust fn main() { tauri::Builder::default() .invoke_handler(tauri::generate_handler![my_custom_handler]) .run(tauri::generate_context!()) .expect("failed to run app"); } #[tauri::command] fn my_custom_handler() { let window = tauri::WindowBuilder::new() .title("My Tauri App") .build() .unwrap(); window.show().unwrap(); } ``` ### tauri::WindowBuilder::new `tauri::WindowBuilder::new` 方法用于创建窗口。在创建窗口时,可以定义窗口的标题、大小、位置、图标等属性。使用 `tauri::WindowBuilder::new` 方法可以获取一个默认的窗口构建器实例,你可以在此基础上进行进一步的配置。 以下是一个简单的示例,使用 `tauri::WindowBuilder::new` 方法创建一个窗口: ```rust fn main() { tauri::Builder::default() .invoke_handler(tauri::generate_handler![my_custom_handler]) .run(tauri::generate_context!()) .expect("failed to run app"); } #[tauri::command] fn my_custom_handler() { let window = tauri::WindowBuilder::new() .title("My Tauri App") .width(800) .height(600) .build() .unwrap(); window.show().unwrap(); } ``` 以上三个 API 是 Tauri 应用程序开发中的重要组成部分,通过它们可以构建 Tauri 应用程序,并且对应用程序的事件进行处理

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值