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

285
Views
how do i solve this error while running javascript in my node.js?

i want to run my script "script.js" on node.js use command "node script.js" but i got this error

  node:internal/modules/cjs/loader:936
  throw err;
  ^
    Error: Cannot find module 'C:\Users\User\script.js'
    [90m    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)[39m
    [90m    at Function.Module._load (node:internal/modules/cjs/loader:778:27)[39m
    [90m    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)[39m
    [90m    at node:internal/main/run_main_module:17:47[39m {
      code: [32m'MODULE_NOT_FOUND'[39m,
      requireStack: []
    }

can anyone help ?

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

0

Please ensure that you are running the node command in the same folder that the script.js file exist. If you are opening command prompt from a different location and try running node script.js, an error will be thrown as

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

Error: Cannot find module 'C:\yourpath\script.js' [90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)[39m [90m at Function.Module._load (internal/modules/cjs/loader.js:725:27)[39m [90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)[39m [90m at internal/main/run_main_module.js:17:47[39m { code: [32m'MODULE_NOT_FOUND'[39m, requireStack: [] }

This indicates that the file doesnot exist in the desired path.

As per your question, you are running the command from C:\Users\User, so your script.js file must be there at the location C:\Users\User\script.js. If your script.js is at some other location, say C:\Users\yourusername\somerandomfolderpath, then you have to open your command prompt at that folder or go to that location using command prompt using these commads.

C:
cd C:\Users\yourusername\somerandomfolderpath

The first command takes you to the required drive (expecting it to be C drive here). The second command takes to the required folder in that drive.

After this you can run your script using.

node script.js
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!