无法解决 wasm-bindgen 依赖冲突

问题描述 投票:0回答:1

我正在使用 Tauri v2。我正在尝试添加令人惊叹的 photon_rs 板条箱以进行图像处理。

当我运行

cargo run
时,我可以看到与
wasm-bindgen
存在版本冲突:

Updating crates.io index
error: failed to select a version for `wasm-bindgen`.
    ... required by package `wasm-streams v0.4.1`
    ... which satisfies dependency `wasm-streams = "^0.4"` of package `reqwest v0.12.0`
    ... which satisfies dependency `reqwest = "^0.12"` of package `tauri v2.0.0`
    ... which satisfies dependency `tauri = "^2"` of package `blurryface v0.0.0 (/Users/jacharles/dev_freelance/tauri-apps/blurryface/src-tauri)`
versions that meet the requirements `^0.2.87` are: 0.2.92, 0.2.95, 0.2.93, 0.2.91, 0.2.90, 0.2.89, 0.2.87

all possible versions conflict with previously selected packages.

  previously selected package `wasm-bindgen v0.2.78`
    ... which satisfies dependency `wasm-bindgen = "=0.2.78"` of package `photon-rs v0.3.2`
    ... which satisfies dependency `photon-rs = "^0.3.2"` of package `blurryface v0.0.0 (/Users/jacharles/dev_freelance/tauri-apps/blurryface/src-tauri)`

failed to select a version for `wasm-bindgen` which could resolve this conflict

问题是...我没有对 tauri 或

photon_rs

使用(或计划使用)wasm

看起来 photon 添加了通过功能标志排除构建 wasm deps 的支持,但它似乎对我不起作用。

我将其添加到我的cargo.toml中(但似乎没有效果?)

photon-rs = { version = "0.3.2", default-features = false } # disables wasm?

我的预感是

wasm-bindgen
正在为整个树重新启用,因为 tauri 将其列为依赖项。

运行

cargo update --package wasm-bindgen
显示此错误:

 Updating crates.io index
error: failed to select a version for `wasm-bindgen`.
    ... required by package `softbuffer v0.4.0`
    ... which satisfies dependency `softbuffer = "^0.4"` of package `tauri-runtime-wry v2.1.2`
    ... which satisfies dependency `tauri-runtime-wry = "^2.1.2"` of package `tauri v2.0.6`
    ... which satisfies dependency `tauri = "^2.0.0"` of package `tauri-plugin-shell v2.0.0`
    ... which satisfies dependency `tauri-plugin-shell = "^2"` of package `blurryface v0.0.0 (/Users/jacharles/dev_freelance/tauri-apps/blurryface/src-tauri)`
versions that meet the requirements `^0.2.86` are: 0.2.95, 0.2.93, 0.2.92, 0.2.91, 0.2.90, 0.2.89, 0.2.87, 0.2.86

all possible versions conflict with previously selected packages.

  previously selected package `wasm-bindgen v0.2.78`
    ... which satisfies dependency `wasm-bindgen = "=0.2.78"` of package `photon-rs v0.3.2`
    ... which satisfies dependency `photon-rs = "^0.3.2"` of package `blurryface v0.0.0 (/Users/jacharles/dev_freelance/tauri-apps/blurryface/src-tauri)`

failed to select a version for `wasm-bindgen` which could resolve this conflict

这是我的

cargo.toml

[package]
name = "blurryface"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
tauri-build = { version = "2", features = [] }


# [patch.crates-io]
# wasm-bind = { git = 'https://github.com/serde-rs/serde.git' }

[dependencies]
tauri = { version = "2", features = [], default-features = false }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
grep = "0.3.1"
walkdir = "2.5.0"
termcolor = "1.4.1"
ignore = "0.4.22"
tauri-plugin-dialog = "2"
tauri-plugin-shell = "2"
photon-rs = { version = "0.3.2", default-features = false } # disables wasm
# enable_wasm

问题

  1. 我可以从 tauri 端禁用 wasm deps 吗?
  2. 我还有哪些其他选项可以强制使用版本?
  3. 我应该分叉 photon_rs 并手动删除我不需要的 deps 吗?
  4. 还有其他选择/想法吗?
rust rust-cargo tauri wasm-bindgen
1个回答
0
投票

在此特定情况下,

wasm-bindgen
版本
=0.2.85
photon-rs
最新发布版本的依赖项。这似乎是一个错误
photon-rs

幸运的是,已经有一个放宽版本的合并提交

您可以在发布之前使用它,只需将

photon-rs
依赖项替换为:

photon-rs = {
    version = "0.3.2",
    default-features = false,
    git = "https://github.com/silvia-odwyer/photon",
    rev = "3b72d357848cd76be9363e87ad0cd02a19b988d2"
}
© www.soinside.com 2019 - 2024. All rights reserved.