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

173
Views
What is the correct way to use modules in Node.js?

Almost every tutorial I look at for Javascript uses require for accessing code from other files. When I run the code, however, I get this error:

ReferenceError: require is not defined in ES module scope, you can use import instead

So, I spend the next hour (at least) trying to figure out how to import the module properly. I am using Node v16.15.0. Should I be using a different version of Node? If not, why are all these tutorials using a different syntax? Is there a setting I should use that allows the use of require?

about 4 years ago · Juan Pablo Isaza
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!