wasm-bindgen
wasm-bindgen copied to clipboard
cannot call wasm-bindgen imported functions on non-wasm targets
Summary
"cannot call wasm-bindgen imported functions on non-wasm targets"
Additional Details
- environment
rustup show
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\Asura7969\.rustup
installed toolchains
--------------------
stable-2022-01-20-x86_64-pc-windows-msvc
stable-x86_64-pc-windows-msvc (default)
nightly-2022-03-03-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc
installed targets for active toolchain
--------------------------------------
wasm32-unknown-unknown
x86_64-pc-windows-msvc
active toolchain
----------------
stable-x86_64-pc-windows-msvc (default)
rustc 1.59.0 (9d1b2106e 2022-02-23)
- cargo run throw panicked
thread 'main' panicked at 'cannot call wasm-bindgen imported functions on non-wasm targets', C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\web-sys-0.3.57\src\features\gen_AudioContext.rs:4:1
stack backtrace:
0: std::panicking::begin_panic<str>
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\std\src\panicking.rs:525
1: web_sys::features::gen_AudioContext::impl$15::new::__wbg_new_14af17251d0bf480
at C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\web-sys-0.3.57\src\features\gen_AudioContext.rs:4
2: web_sys::features::gen_AudioContext::AudioContext::new
at C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\web-sys-0.3.57\src\features\gen_AudioContext.rs:4
3: fly::main::generator$0
at .\src\main.rs:14
4: core::future::from_generator::impl$1::poll<fly::main::generator$0>
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\core\src\future\mod.rs:84
5: tokio::park::thread::impl$5::block_on::closure$0<core::future::from_generator::GenFuture<fly::main::generator$0> >
at C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.17.0\src\park\thread.rs:263
6: tokio::coop::with_budget::closure$0<enum$<core::task::poll::Poll<enum$<core::result::Result<tuple$<>,anyhow::Error>, 1, 18446744073709551615, Err> > >,tokio::park::thread::impl$5::block_on::closure$0>
at C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.17.0\src\coop.rs:102
7: std::thread::local::LocalKey<core::cell::Cell<tokio::coop::Budget> >::try_with<core::cell::Cell<tokio::coop::Budget>,tokio::coop::with_budget::closure$0,enum$<core::task::poll::Poll<enum$<core::result::Result<tuple$<>,anyhow::Error>, 1, 184467440737095516
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\std\src\thread\local.rs:412
8: std::thread::local::LocalKey<core::cell::Cell<tokio::coop::Budget> >::with<core::cell::Cell<tokio::coop::Budget>,tokio::coop::with_budget::closure$0,enum$<core::task::poll::Poll<enum$<core::result::Result<tuple$<>,anyhow::Error>, 1, 18446744073709551615,
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\std\src\thread\local.rs:388
9: tokio::coop::with_budget
at C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.17.0\src\coop.rs:95
10: tokio::coop::budget
at C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.17.0\src\coop.rs:72
11: tokio::park::thread::CachedParkThread::block_on<core::future::from_generator::GenFuture<fly::main::generator$0> >
at C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.17.0\src\park\thread.rs:263
12: tokio::runtime::enter::Enter::block_on<core::future::from_generator::GenFuture<fly::main::generator$0> >
at C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.17.0\src\runtime\enter.rs:151
13: tokio::runtime::thread_pool::ThreadPool::block_on<core::future::from_generator::GenFuture<fly::main::generator$0> >
at C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.17.0\src\runtime\thread_pool\mod.rs:73
14: tokio::runtime::Runtime::block_on<core::future::from_generator::GenFuture<fly::main::generator$0> >
at C:\Users\Asura7969\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.17.0\src\runtime\mod.rs:477
15: fly::main
at .\src\main.rs:18
16: core::ops::function::FnOnce::call_once<enum$<core::result::Result<tuple$<>,anyhow::Error>, 1, 18446744073709551615, Err> (*)(),tuple$<> >
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\core\src\ops\function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\fly.exe` (exit code: 101)
This is because you're trying to run your app in a non-wasm environment. Remember, cargo run is not used to run a wasm app. Depending upon what your app is, you can use either wasm-pack or trunk to build and run it. Also see the wasm-bindgen book.
This is because you're trying to run your app in a non-wasm environment. Remember,
cargo runis not used to run a wasm app. Depending upon what your app is, you can use either wasm-pack or trunk to build and run it. Also see the wasm-bindgen book.
I got it thank you
thanks for this