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

231
Views
Why babel-node "Cannot find module" without ".js" extension?

I dont know why babel-node does not import without ".js" extension.

  • I have "type": "module" in package.js
  • import example from "./src/example.js"; works fine
  • import example from "./src/example"; doesnt work
  • --es-module-specifier-resolution=node works only when I dont use babel-node

package.js

    "type": "module",
    "scripts": {
        "start": "node  ./index.js --exec babel-node -e js --experimental-modules --es-module-specifier-resolution=node "
    },
    "dependencies": {
        "bcrypt": "^5.0.1",
        "body-parser": "^1.20.0",
        "express": "^4.18.1",
        "jsonwebtoken": "^8.5.1",
        "mongoose": "^6.3.5",
        "nodemon": "^2.0.16",
        "npm": "^8.12.1"
    },
    "devDependencies": {
        "@babel/cli": "^7.17.10",
        "babel-preset-env": "^1.7.0",
        "babel-preset-stage-0": "^6.24.1"
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

npm install @babel/node solved my problem

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!