Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
Installing troika-three-text from npm not working?

I need to add some texts to a scene in three-js and I've seen Troika seems to be perfect for it. The problem is that when I install troika, I can't find a way to call the module, and/or it has problems with references... I don't seem to find anything related anywhere, people ask questions like they simply install troika and voi-la, and for me it's been complicated

so I have three running perfectly, then I install troika (npm install troika-three-text)

it generates some folders in the node_modules folder, now the instalation tells you that you have to call it using

import { Text } from 'troika-three-text',

when I do this, I get this message:

'Uncaught TypeError: Failed to resolve module specifier "troika-three-text". Relative references must start with either "/", "./", or "../".'

so then I try with:

import { Text } from '../node_modules/troika-three-text/dist/troika-three-text.esm.js'

and now the problem is the following...

'Failed to resolve module specifier "troika-worker-utils". Relative references must start with either "/", "./", or "../".'

So I don't know what to do, either I have to manually change every path inside the scripts of all the troika folders, or what? it doesn't make any sense, please someone help me U_U thank you!!!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I just ran into this problem as well while playing, with troika.

This may not be a perfect solution,but it's a good workaround because I use three.js in the browser, not in nodejs. My main script is loaded in the index.html file using type="module" and also in the index.html file is an "import map" that uses defines the necessary names as follows:

<html>
  <head>

    <script type="importmap">
      {
      "imports" : {
          "three": "http://unpkg.com/three@latest/build/three.module.js",
          "troika-three-text": "http://unpkg.com/troika-three-text@latest/dist/troika-three-text.esm.js",
          "troika-three-utils": "http://unpkg.com/troika-three-utils@latest/dist/troika-three-utils.esm.js",
          "troika-worker-utils": "http://unpkg.com/troika-worker-utils@latest/dist/troika-worker-utils.esm.js",
           ...
      }
      }
    </script>

Note that I'm getting these files from the unpkg.com CDN. You may have to do something a bit different.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda