首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TypeError: WebAssembly.instantiate():导入#0 module="env“错误:模块不是对象或函数

TypeError: WebAssembly.instantiate():导入#0 module="env“错误:模块不是对象或函数
EN

Stack Overflow用户
提问于 2021-10-13 11:20:11
回答 1查看 593关注 0票数 4

我们目前正在与Next.js和Three.js (反应-三纤维)一起进行一个项目。在浏览器中清除缓存后,3d模型不再显示。我们会犯一些错误。实际上,一次警告是一个错误(多次)。错误是

代码语言:javascript
复制
Uncaught (in promise) RuntimeError: abort(TypeError: WebAssembly.instantiate(): Import #0 module="env" error: module is not an object or function). Build with -s ASSERTIONS=1 for more info.

我们确实使用了一些环境变量,但没有特别导入模块"env“。参数("-s ASSERTIONS=1")对我们不起作用。

控制台输出开始时出现的另一个警告是:

代码语言:javascript
复制
failed to asynchronously prepare wasm: TypeError: WebAssembly.instantiate(): Import #0 module="env" error: module is not an object or function

错误有时会出现,有时不会出现,我们不知道原因。

谢谢你做的一切

编辑:

代码语言:javascript
复制
"dependencies": {
  "@heroicons/react": "^1.0.1",
  "@next/env": "^11.1.2",
  "@react-three/drei": "^2.2.13",
  "@tweenjs/tween.js": "^18.6.4",
  "autoprefixer": "^10.2.5",
  "axios": "^0.21.1",
  "drei": "^2.2.13",
  "framer-motion": "^4.1.8",
  "iso-3166-1": "^2.0.1",
  "jwt-decode": "^3.1.2",
  "moment": "^2.29.1",
  "next": "^11.0.0",
  "postcss": "^8.2.12",
  "react": "^17.0.2",
  "react-country-flag": "^2.3.0",
  "react-dom": "^17.0.2",
  "react-fps-stats": "^0.1.3",
  "react-icons": "^4.2.0",
  "react-loader-spinner": "^4.0.0",
  "react-select": "^4.3.1",
  "react-simple-maps": "^2.3.0",
  "react-spring": "^8.0.27",
  "react-three-fiber": "^5.3.11",
  "react-time-ago": "^6.2.2",
  "react-tooltip": "^4.2.21",
  "swr": "^0.5.5",
  "tailwindcss": "^2.1.1",
  "three": "^0.124.0",
 "use-asset": "^1.0.4"
},
"devDependencies": {
  "eslint": "^7.24.0",
  "eslint-config-airbnb": "^18.2.1",
  "eslint-config-next": "^11.0.0",
  "eslint-config-prettier": "^8.2.0",
  "eslint-plugin-jsx-a11y": "^6.4.1",
  "eslint-plugin-prettier": "^3.4.0",
  "eslint-plugin-react": "^7.23.2",
  "eslint-plugin-react-hooks": "^4.2.0",
  "eslint-plugin-security": "^1.4.0",
  "eslint-plugin-simple-import-sort": "^7.0.0",
  "eslint-plugin-sonarjs": "^0.6.0",
  "eslint-plugin-tailwindcss": "^1.13.2",
  "eslint-plugin-unicorn": "^30.0.0",
  "husky": "^6.0.0",
  "lint-staged": "^10.5.4",
  "prettier": "^2.2.1"
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-14 07:47:32

在我们的例子中,我们将draco解码器路径设置为:

https://www.gstatic.com/draco/v1/decoders/

通过呼叫:

this.dracoLoader.setDecoderPath("https://www.gstatic.com/draco/v1/decoders/");

但是他们推荐的方法是在URL中指定版本:

https://www.gstatic.com/draco/versioned/decoders/1.4.3/

他们昨天发布了一个新版本,解释了突然出现的错误:https://github.com/google/draco/releases/tag/1.4.3

更改为版本化的URL,为我们修复它。另一个有效的解决方法是使用JS而不是组件:

this.dracoLoader.setDecoderConfig({ type: "js" });

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69554577

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档