简体   繁体   中英

internal/modules/cjs/loader.js:883 throw err;

Here is the code:

const fs= require("fs");
const text=fs.readFileSync("dele.txt","utf-8");
console.log(text);

Here is the error in terminal:

Error: Cannot find module 'D:\programs\web development\tut64.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)       
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

In your script you are asking for fs module.

Try to run npm install fs in your console and be sure that you are running the command in your root folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM