Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!