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

384
Views
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'models' imported from

I'm trying to configure my project to use absolute imports, so I have configured jsconfig.json as follows:

{
    "compilerOptions": {
       "baseUrl": "./src",
       "module": "commonjs",
       "target": "es2016"
    },
   "exclude": ["node_modules", "**/node_modules/*"]
}

My project structure looks like this:

enter image description here

but when I try to do an import like import { Account } from "models"; I get the following error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'models' imported from...

How can I solve this ?

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

0

The jsconfig.json file is used by VSCode's language server for static JavaScript analysis, it is not read by Node.js and therefore doesn't affect module loading in any way.

Options which come to mind are to use a transpiler, for example tsc, to transpile JS files (see this answer), or use native ESM support in Node.js possibly with custom loader. Mind that by default ESM imports expect full filename, including file extension (omitting file extensions in ESM is TypeScript specific quirk).

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!