vue.js - 未找到 TextGeometry.js 和 FontLoader.js 依赖项
问题描述
我使用 Trois.js 来创建 Vue.js+Three.js 应用程序。我安装了Trois.js
库:
npm install three@0.127 troisjs
我将一些基本元素导入到我的 Vue 模块中,例如Renderer
,Scene
等等。
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"
}
解决方案
TextGeometry
并被FontLoader
移至带有 的示例r133
。意思trois.js
是希望您使用更新的three.js
版本而不是r127
.
推荐阅读
- java - 无法将大量素数打印到控制台
- python - 输入为字典python列表
- r - cascadePanes = TRUE 的 searchPanes - 在 R 的数据表包中不起作用
- javascript - 运行时环境和编译器/解释器是否相同?
- javascript - React google maps 多边形顶点问题(只想突出显示该区域而不自动关闭路径)
- php - PG 终止后端
- visual-studio-code - 如何在 Visual Studio 代码的整个代码中用 x?.y 替换 x?xy
- google-chrome - Chrome:在 ec2 服务器上收到两次停滞的请求
- eclipse - 在 Eclipse 中安装 ObjectAid UML Explorer 插件时出错
- flutter - 不推荐使用 textTheme 颤动的警告