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

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

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 Report

0

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

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!