tauri 1.0升级到2.0的问题

默认分类 · 3 天前

tauri 2.0还处于beta阶段,不过也可以慢慢试用了,今天准备把1.0升级为2.0,有点小问题,记录下。

1.问题症状1

在debian 12下,输入pnpm tauri dev,出现如下错误信息:

cargo:warning=

  pkg-config exited with status code 1

  > PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags javascriptcoregtk-4.1 javascriptcoregtk-4.1 >= 2.38

  The system library `javascriptcoregtk-4.1` required by crate `javascriptcore-rs-sys` was not found.

  The file `javascriptcoregtk-4.1.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.

  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `javascriptcoregtk-4.1.pc`.

warning: build failed, waiting for other jobs to finish...

 ELIFECYCLE  Command failed.

2.解决办法1

打开终端,输入下面内容

sudo apt install libwebkit2gtk-4.1-dev

3.问题症状2

运行pnpm tauri dev,出现

Failed to resolve import @tauri-apps/api/core from src/main.ts

4.解决办法2

打开终端,输入下面内容:

pnpm update @tauri-apps/api@next
linux tauri
Theme Jasmine by Kent Liao