该错误通常是由于尝试在不支持 WebAssembly 的环境中加载 WebAssembly 模块引起的。需要确保你的浏览器或 Node.js 运行的版本支持 WebAssembly,并且你正确加载了 WebAssembly 模块。以下是一个加载 WebAssembly 模块的示例代码:
fetch('example.wasm') // 加载 WebAssembly 模块
.then(response => response.arrayBuffer())
.then(bytes => WebAssembly.instantiate(bytes))
.then(results => {
const {exports} = results.instance;
// 在返回的结果中使用模块输出
});