1

I am new to Node.js and I am trying to run my test files via Node.js. I am simply typing node .\tut63.js but it is showing the following error:

Error: Cannot find module 'C:\Users\User11\Desktop\Complete Web Developement Bootcamp\tut63.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: []
}

I am simply running a console.log("HelloWorld"); as my test.js file

iraj jelodari
  • 3,118
  • 3
  • 35
  • 45
user11
  • 11
  • 1
  • 2
  • 1
    Can you provide the file contents? Your question is not meaningful if you try running `tut63.js` and your file name is `test.js`. – Lakshaya U. Jun 22 '21 at 10:05

4 Answers4

0

Your file is called "test.js", right? Try running:

node test.js
0

Could also be related to a broken node installation. Try reinstalling it completely. You can also try to remove npm completely at %AppData%\npm\node_modules before reinstalling everything (related, but not Windows: Node MODULE_NOT_FOUND)

auser
  • 6,307
  • 13
  • 41
  • 63
tpschmidt
  • 2,479
  • 2
  • 17
  • 30
0

If your file name is test.js then you need to navigate to the directory where your project is in the terminal. Then run node test.js. Hop it works

0

Make sure to install the npm packages:

npm install
Shahar Shokrani
  • 7,598
  • 9
  • 48
  • 91