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

417
Views
Inquirer on node.js
PS D:\Cursos\nodeudemy\aulas\2_FUNDAMENTOS\10_abstracao_input> node index.js
D:\Cursos\nodeudemy\aulas\2_FUNDAMENTOS\10_abstracao_input\index.js:1
const inquirer = require('inquirer')
                 ^

Error [ERR_REQUIRE_ESM]: require() of ES Module D:\Cursos\nodeudemy\aulas\2_FUNDAMENTOS\10_abstracao_input\node_modules\inquirer\lib\inquirer.js from D:\Cursos\nodeudemy\aulas\2_FUNDAMENTOS\10_abstracao_input\index.js not supported.
Instead change the require of inquirer.js in D:\Cursos\nodeudemy\aulas\2_FUNDAMENTOS\10_abstracao_input\index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (D:\Cursos\nodeudemy\aulas\2_FUNDAMENTOS\10_abstracao_input\index.js:1:18) {
  code: 'ERR_REQUIRE_ESM'
}

It happens every time i try to run a node file w/ inquirer

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you read the docs it explains you this problem and it provides a link on how to solve the issue.

Inquirer v9 and higher are native esm modules, this mean you cannot use the commonjs syntax require('inquirer') anymore. If you want to learn more about using native esm in Node, I'd recommend reading the following guide. Alternatively, you can rely on an older version until you're ready to upgrade your environment:

npm install --save inquirer@^8.0.0

This will then allow import inquirer with the commonjs require:

const inquirer = require('inquirer');
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!