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

860
Views
ts-node TypeError [ERR_UNKNOWN_FILE_EXTENSION]: extensión de archivo desconocida ".ts"

Estoy usando ts-node pero me está dando este error:

 $ ts-node index.ts TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /home/projects/node-hddds8/index.ts

Traté de eliminar "type": "module" de mi package.json pero en ese caso aparece un error diferente:

 $ ts-node index.ts (node:45) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. (Use `node --trace-warnings ...` to show where the warning was created) /home/projects/node-hddds8/index.ts:1 import chalk from 'chalk'; ^^^^^^ SyntaxError: Cannot use import statement outside a module

Aquí hay un enlace de reproducción en StackBlitz: https://stackblitz.com/edit/node-hddds8?file=index.ts

Mi paquete.json se ve así:

 { "name": "node-starter", "version": "0.0.0", "type": "module", "dependencies": { "chalk": "^5.0.1", "ts-node": "^10.8.1", "typescript": "^4.7.4" } }

Y mi tsconfig.json se ve así:

 { "compilerOptions": { "target": "esnext", "module": "esnext", "moduleResolution": "Node", } }

Y mi index.ts se ve así:

 import chalk from 'chalk'; console.log(chalk.blue('Hello world!'));
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!