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

235
Views
importar módulo fs: error tipográfico no detectado

Estoy tratando de usar el módulo de nodo en mi código mecanografiado, sin embargo, aparece este error: Uncaught TypeError: Failed to resolve module specifier "fs". Relative references must start with either "/", "./", or "../". Miré las publicaciones anteriores en stackflow e intenté actualizar mi archivo tscofig.json. He intentado importarlo como:

 import * as fs from "fs"; const fs = require('fs');

Sin embargo, ambos dan como resultado el error de tiempo de ejecución. Aquí está mi archivo tsconfig.json:

 { "compilerOptions": {     "target": "es5",    "module": "ES6",    "rootDir": "./src",    "outDir": "./dist"   } }

Sería genial si alguien me puede guiar hacia la causa del error y las posibles soluciones。

PD He intentado reinstalar módulos de nodo usando npm install --save @types/node

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

0

Cambiar tsconfig.json como

 { "compilerOptions": { "target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ "module": "commonjs", /* Specify what module code is generated. */ "rootDir": "./src", /* Specify the root folder within your source files. */ "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ "outDir": "./dist", /* Specify an output folder for all emitted files. */ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ "strict": true, /* Enable all strict type-checking options. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ } }
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!