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

231
Views
Node.JS can't find Module inside Folder

I made a folder. Then cloned code from GH into it. so it's a folder inside my folder. I run (node index.js) and it throws 'error, module not found. What can I do differently?

`josh@Joshs-MBP random % node index.js
node:internal/modules/cjs/loader:927
  throw err;
  ^

Error: Cannot find module '/Users/josh/Desktop/random/index.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769: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: []
}josh@Joshs-MBP random % `
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Problem -

Running node index.js throws a module not found error.

Solution -

You need to change directory one directory level deeper.

You are currently in

/Users/josh/Desktop/random/index.js

You said you created a directory, then put a Github repo inside of that directory. That means you need to change directory into the Github repo still.

If you look at the error it shows that you are running node index.js inside of a directory on your Desktop.

Based on your description of putting a Github repo inside of a directory you created, you likely need to use cd to move into it.

Solution -

  1. cd repoName

  2. ls to verify index.js is in the current location.

  3. When you see index.js in the output from ls type node index.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!