Dioxus: Difference between revisions
CathalMullan (talk | contribs) Further explanation of wasm-bindgen pinning of CLI. |
CathalMullan (talk | contribs) m Fix cargo log message |
||
Line 21: | Line 21: | ||
</syntaxhighlight>Run ''cargo update'', and you should see the version being downgraded.<syntaxhighlight lang="text"> | </syntaxhighlight>Run ''cargo update'', and you should see the version being downgraded.<syntaxhighlight lang="text"> | ||
Downgrading wasm-bindgen v0.2.99 -> v0.2.97 (available: v0.2.99) | |||
</syntaxhighlight>You will also want to ensure the version of ''wasm-bindgen-cli'' matches, which can be done via looking up the current version from the lock file. <syntaxhighlight lang="nix"> | </syntaxhighlight>You will also want to ensure the version of ''wasm-bindgen-cli'' matches, which can be done via looking up the current version from the lock file. <syntaxhighlight lang="nix"> | ||
cargoLock = builtins.fromTOML (builtins.readFile ./Cargo.lock); | cargoLock = builtins.fromTOML (builtins.readFile ./Cargo.lock); |
Revision as of 18:35, 24 December 2024
Dioxus is a full-stack Rust app framework for web, desktop, mobile, and more.
Troubleshooting
wasm-bindgen mismatch
A common issue when using the dioxus-cli version from Nixpkgs is encountering the following error:
it looks like the Rust project used to create this Wasm file was linked against
version of wasm-bindgen that uses a different bindgen format than this binary:
rust Wasm file schema version: 0.2.99
this binary schema version: 0.2.97
There are two solutions to solving this:
- Pin wasm-bindgen to the version the dioxus-cli expects.
- Update dioxus-cli to use a newer lock file.
Pinning wasm-bindgen
Within your Cargo.toml file, force wasm-bindgen to use the expected version.
[dependencies]
wasm-bindgen = "=0.2.97"
Run cargo update, and you should see the version being downgraded.
Downgrading wasm-bindgen v0.2.99 -> v0.2.97 (available: v0.2.99)
You will also want to ensure the version of wasm-bindgen-cli matches, which can be done via looking up the current version from the lock file.
cargoLock = builtins.fromTOML (builtins.readFile ./Cargo.lock);
wasmBindgen = pkgs.lib.findFirst
(pkg: pkg.name == "wasm-bindgen")
(throw "Could not find wasm-bindgen package")
cargoLock.package;
wasm-bindgen-cli = pkgs.wasm-bindgen-cli.override {
version = wasmBindgen.version;
hash = pkgs.lib.fakeHash;
cargoHash = pkgs.lib.fakeHash;
};