Skip to content
Tauri 中文网

更新依赖

更新 npm 包

¥Update npm Packages

如果你使用的是 tauri 包:

¥If you are using the tauri package:

npm install @tauri-apps/cli@latest @tauri-apps/api@latest

你还可以使用以下命令在命令行上检测 Tauri 的最新版本:

¥You can also detect what the latest version of Tauri is on the command line, using:

npm outdated @tauri-apps/cli

更新 Cargo 包

¥Update Cargo Packages

你可以使用 cargo outdated 或在 crates.io 页面上检查过时的软件包:tauri / tauri-build.

¥You can check for outdated packages with cargo outdated or on the crates.io pages: tauri / tauri-build.

转到 src-tauri/Cargo.toml 并将 tauritauri-build 更改为

¥Go to src-tauri/Cargo.toml and change tauri and tauri-build to

[build-dependencies]
tauri-build = "%version%"
[dependencies]
tauri = { version = "%version%" }

其中 %version% 是上述对应的版本号。

¥where %version% is the corresponding version number from above.

然后执行以下操作:

¥Then do the following:

Terminal window
cd src-tauri
cargo update

或者,你可以运行 cargo-edit 提供的 cargo upgrade 命令,该命令会自动补齐所有这些操作。

¥Alternatively, you can run the cargo upgrade command provided by cargo-edit which does all of this automatically.

同步 npm 软件包和 Cargo Crates 版本

¥Sync npm Packages and Cargo Crates versions

由于 JavaScript API 依赖于后端的 Rust 代码,因此添加新功能需要同时升级两端以确保兼容性。请确保同步的 npm 包 @tauri-apps/api 和 cargo crate tauri 的次要版本号相同。

¥Since the JavaScript APIs rely on Rust code in the backend, adding a new feature requires upgrading both sides to ensure compatibility. Please make sure you have the same minor version of the npm package @tauri-apps/api and cargo crate tauri synced

对于插件,我们可能会在补丁版本中引入此类更改,因此我们会将 npm 包和 Cargo Crate 版本合并,你需要保持版本同步。例如,你需要相同版本的 npm 包 @tauri-apps/plugin-fs 和 Cargo Crate tauri-plugin-fs(例如 2.2.1)。

¥And for the plugins, we might introduce this type of changes in patch releases, so we bump the npm package and cargo crate versions together, and you need to keep the exact versions synced, for example, you need the same version (e.g. 2.2.1) of the npm package @tauri-apps/plugin-fs and cargo crate tauri-plugin-fs


Tauri v2.6 中文网 - 粤ICP备13048890号
Nodejs.cn 旗下网站