0

I am having this issue when trying to run node index.js in my terminal on VSC.

This is the error,

[Try the new cross-platform PowerShell https://aka.ms/pscore6

PS Z:\01 Code notes> node index.js
node:internal/modules/cjs/loader:944
throw err;
^

Error: Cannot find module 'Z:\01 Code notes\index.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)        
at Function.Module._load (node:internal/modules/cjs/loader:774:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
PS Z:\01 Code notes> ][1]

I have tried so many different things. I tried all the suggested fixes on these pages, Node MODULE_NOT_FOUND

Why does VsCode NPM throw a module not found error?

https://github.com/Microsoft/vscode/issues/65893

Any suggestions?

  • I've had issues in the past with certain type of folder names that node doesn't like. I would try renaming the folder without the spaces. – Mike May 25 '21 at 20:47
  • I tried it locally and wasn't able to reproduce it, but I know it has happened. Is there a node_modules folder in there? It looks like your taking a course, sometimes the class will have the package.json, but you need to run "npm install" to install any of the dependency packages. – Mike May 25 '21 at 20:54

1 Answers1

0

That means you are using a module that you haven't installed, check your code.

  • Z:\01 Code notes\index.js, look at the file where you are using this "module" –  May 25 '21 at 18:55