Home > database >  TextGeometry.js and FontLoader.js dependencies were not found
TextGeometry.js and FontLoader.js dependencies were not found

Time:11-11

I use Trois.js to create Vue.js Three.js app. I installed Trois.js library:

npm install [email protected] troisjs

I imported some basic elements to my Vue module, just like Renderer, Scene etc.

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

When I run npm run serve then the error comes up:

These dependencies were not found:

  • three/examples/jsm/geometries/TextGeometry.js in ./node_modules/troisjs/build/trois.module.js
  • three/examples/jsm/loaders/FontLoader.js in ./node_modules/troisjs/build/trois.module.js

What's interesting, TextGeometry and FontLoader exist in node_modules under abovementioned directory:

..build/trois.module.js

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

I don't know why this error comes up, I reinstalled trois.js package but in vain. Still doesn't work. This is my package.json file:

{
  "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"
}

CodePudding user response:

TextGeometry and FontLoader were moved to the examples with r133. Meaning trois.js expects that you work with a more recent three.js version and not with r127.

  • Related