Module imports function '__wbindgen_describe' from '__wbindgen_placeholder__' that is not exported by the runtime

I used these dependencies to implement the signature verification of sr25519. The compilation passed, but an error was reported during local deploy. How to solve it

image

error message:
The Replica returned an error: code 5, message: “Wasm module of canister rwlgt-iiaaa-aaaaa-aaaaa-cai is not valid: Wasm module has an invalid import section. Module imports function ‘__wbindgen_describe’ from ‘wbindgen_placeholder’ that is not exported by the runtime.”

Just ran into this, adding what I found if someone wants to dig deeper.

This errors out

getrandom = { version = "0.2.6", features = ["js"]}
rand = "0.8.5"

Error: The Replica returned an error: code 5, message: “Wasm module of canister rrkah-fqaaa-aaaaa-aaaaq-cai is not valid: Wasm module has an invalid import section. Module imports function ‘__wbindgen_describe’ from ‘wbindgen_placeholder’ that is not exported by the runtime.”

This works

getrandom = { version = "0.2.3", features = ["js"]}
rand = "0.7.3"

$ dfx --version
dfx 0.9.3

1 Like