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

349
Vistas
require() of ES modules not supported
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\...\node_modules\normalize-url\index.js
[0] require() of ES modules is not supported.
[0] require() of D:\...\node_modules\normalize-url\index.js from D:\...\routes\api\users.js is an ES module file as it is a .js file whose nearest parent package.json contains "type":
"module" which defines all .js files in that package scope as ES modules.
[0] Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\Personnel\Linu
x downloads n docs\Docs\Project 2\node_modules\normalize-url\package.json.

I tried to downgrade the node-fetchand type:module, nothing worked.

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

0

You installed a new version of normalize-url whose package.json contains {type:module} this is deduced from:

...package.json contains "type":"module"

Because modules are loaded using 'import' and not 'require', Node returns an error.


How to solve

You probably need the CJS scripts.

Remove and reinstall the package the standard way (npm remove normalize-url && npm i normalize-url). If npm i normalize-url@latest is installed then it is a ES2015 and only work with import statements.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Downgraded the node version to LTS, and it started working.

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