【问题标题】:TextGeometry.js and FontLoader.js dependencies were not found未找到 TextGeometry.js 和 FontLoader.js 依赖项
【发布时间】:2021-12-23 08:30:17
【问题描述】:

我使用 Trois.js 来创建 Vue.js+Three.js 应用程序。我安装了Trois.js 库:

npm install three@0.127 troisjs

我在我的 Vue 模块中导入了一些基本元素,例如 RendererScene 等。

import {Renderer, Scene, Camera, Sphere} from 'troisjs'

当我运行npm run serve 时出现错误:

未找到这些依赖项:

  • ./node_modules/troisjs/build/trois.module.js 中的三个/examples/jsm/geometries/TextGeometry.js
  • ./node_modules/troisjs/build/trois.module.js 中的三个/examples/jsm/loaders/FontLoader.js

有趣的是,TextGeometry 和 FontLoader 存在于上述目录下的 node_modules 中:

..build/trois.module.js

import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry.js';
import { FontLoader } from 'three/examples/jsm/loaders/FontLoader.js';
...

我不知道为什么会出现这个错误,我重新安装了trois.js 包但徒劳无功。还是不行。这是我的package.json 文件:

{
  "name": "troisapp",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "three": "^0.127.0",
    "troisjs": "^0.3.3",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vue/eslint-config-prettier": "^6.0.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-prettier": "^3.3.1",
    "eslint-plugin-vue": "^7.0.0",
    "prettier": "^2.2.1"
  },
  "description": "## Project setup ``` npm install ```",
  "main": ".eslintrc.js",
  "keywords": [],
  "author": "",
  "license": "ISC"
}

【问题讨论】:

    标签: vue.js three.js


    【解决方案1】:

    TextGeometryFontLoader 已移至带有 r133 的示例。意思是trois.js 期望您使用更新的three.js 版本而不是r127

    【讨论】:

    • 好的,所以基本上这意味着我需要安装最新的three.js 库?我认为通过安装trois.js 我还安装了最新版本的three.js
    • 我从未使用过troisjs,但根据他们的示例,您不必单独安装three.js。最新版的troisjs顺便依赖r134
    猜你喜欢
    • 1970-01-01
    • 2021-03-17
    • 2019-02-24
    • 2021-06-16
    • 2017-09-18
    • 2013-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多