wasm-bindgen CLI 在尝试构建时不起作用

wasm-bindgen CLI not working when trying to build

提问人:gdor11 提问时间:11/17/2023 最后编辑:gdor11 更新时间:11/21/2023 访问量:33

问:

当我尝试使用 时,它会输出以下内容(带有):wasm-pack buildRUST_BACKTRACE=full

[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
    Finished release [optimized] target(s) in 0.01s
[INFO]: ⬇️  Installing wasm-bindgen...
thread 'main' panicked at crates/cli-support/src/descriptor.rs:222:15:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0:        0x104e7b96b - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h65343ad3a85b4e34
   1:        0x104e99acb - core::fmt::write::h11839d3825cb5605
   2:        0x104e78e9e - std::io::Write::write_fmt::h3ab12d369399333c
   3:        0x104e7b749 - std::sys_common::backtrace::print::h405f7c76ca12eb27
   4:        0x104e7cdc5 - std::panicking::default_hook::{{closure}}::hed87c355606e1822
   5:        0x104e7caf1 - std::panicking::default_hook::hdf696ec8ea0d65aa
   6:        0x104e7d330 - std::panicking::rust_panic_with_hook::h7c5059af1af54377
   7:        0x104e7d253 - std::panicking::begin_panic_handler::{{closure}}::hd658b0e1cffe3d4d
   8:        0x104e7be49 - std::sys_common::backtrace::__rust_end_short_backtrace::h3d7834d0cea60a50
   9:        0x104e7cf7d - _rust_begin_unwind
  10:        0x104ec4b83 - core::panicking::panic_fmt::ha9964785de0afb40
  11:        0x104ec4cd2 - core::panicking::panic_bounds_check::ha3cb2c69f1775d16
  12:        0x104cff9c8 - wasm_bindgen_cli_support::descriptor::Descriptor::_decode::hcf7e629581de6fe9
  13:        0x104cf79d5 - wasm_bindgen_cli_support::descriptors::execute::h02522f0eed98264f
  14:        0x104ce2dc4 - wasm_bindgen_cli_support::Bindgen::generate_output::h1326299c76136af7
  15:        0x104c75c49 - wasm_bindgen::main::h2a010fa27f679ef8
  16:        0x104c73b56 - std::sys_common::backtrace::__rust_begin_short_backtrace::h2dd174074676d721
  17:        0x104c73b6c - std::rt::lang_start::{{closure}}::h0074e5c032d1ff00
  18:        0x104e742ca - std::rt::lang_start_internal::h54faea1e36783632
  19:        0x104c7620c - _main
Error: Running the wasm-bindgen CLI
Caused by: Running the wasm-bindgen CLI
Caused by: failed to execute `wasm-bindgen`: exited with exit status: 101
  full command: "/Users/gabrielramalho/Library/Caches/.wasm-pack/wasm-bindgen-3a58835161a6b92c/wasm-bindgen" "/Users/gabrielramalho/Desktop/multiple-pendulum/target/wasm32-unknown-unknown/release/multiple_pendulum.wasm" "--out-dir" "/Users/gabrielramalho/Desktop/multiple-pendulum/pkg" "--typescript" "--target" "bundler"

其中 是项目的正确目录。/Users/gabrielramalho/Desktop/multiple-pendulum

我在谷歌上搜索了这个错误,发现了一个问题,指出 wasm-bindgen 的 CLI 和 crate 版本需要相同。它们确实不一样:创建版本是 0.2.84,而 CLI 版本是 0.2.88。
但即便如此,在我将 Cargo.toml 更改为使用 wasm-bindgen 0.2.88 后,问题仍然存在,我仅通过谷歌搜索没有找到任何其他内容。

rust webassembly wasm-bindgen wasm-pack

评论


答: 暂无答案