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

257
Vistas
Node.js and node_modules are less a TextEncoder within whatwg-url

I am attempting to run a set of files, and this error keeps popping up. I ran a separate set of files, loading a rest API to my localhost and that worked without error, but switching back to the first set of files still ends in the follow error:

const utf8Encoder = new TextEncoder();
                    ^

ReferenceError: TextEncoder is not defined
    at Object.<anonymous> (devel/node_modules/whatwg-url/dist/encoding.js:2:21)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (devel/node_modules/whatwg-url/dist/url-state-machine.js:5:34)
    at Module._compile (internal/modules/cjs/loader.js:778:30)

I have attempting to reinstall node.js, as well as update and manually delete the modules that are calling for this TextEncoder. The differences in required modules includes 'mongodb' and and 'csv-parse', which were on my personal machine, but not my office machine. Before I 'npm install ...' these two modules, the error appeared, so I then install the two modules, yet the error still persists. I also updated nodejs and again the error was the same. Any ideas on how to fix this so I can run my code?

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

0

I figured it out, it had to do with my mongodb and node_modules unbalanced connectivity, where I went to `/node_modules/whatwg-url/dist/encoding.js and imported the libraries for the TectEncoder and Text Decoder. The other way this can be fixed is at the top of the files using mongodb, insert...

global.TextEncoder = require("util").TextEncoder; global.TextDecoder = require("util").TextDecoder;

Either way fixes the compatibility issue.

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