Ask coding questions

← Back to all posts
Error: Cannot find module '/home/runner/DangerousBiodegradableErrors/index.js'
ManujHazarika (0)

So I'm just a newbie to node.js and I'm using the file system module to copy and paste the content of one txt file to other. But while running the JS file the shell shows the following screen:

~/DangerousBiodegradableErrors$ node index.js
internal/modules/cjs/loader.js:818
throw err;
^

Error: Cannot find module '/home/runner/DangerousBiodegradableErrors/index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Function.executeUserEntryPoint as runMain
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
~/DangerousBiodegradableErrors$ node index.js
internal/modules/cjs/loader.js:818
throw err;
^

Error: Cannot find module '/home/runner/DangerousBiodegradableErrors/index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Function.executeUserEntryPoint as runMain
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Comments
hotnewtop
ruiwenge2 (1191)

move the index.js file out of the intro-to-node folder