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

256
Views
Why can't my Node.js application find a module?

I'm trying to start my app but every time I try npm run dev I get an error:

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

Error: Cannot find module 'C:\Users\myname\Desktop\mern\index.js'
code: 'MODULE_NOT_FOUND',
  requireStack: []

I don't remember this ever happening in the past so I'm at a lost for words. I tried deleting node_modules / package.json & re-installing them but that didn't work. Here is my code:

package.json:

{
  "name": "mern",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node src/index.js",
    "dev": "nodemon src/index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "nodemon": "^2.0.13"
  }
}

I think the problem has to be here in the package.json file but this is how i've always written it so I'm not sure what to do. Some help will be appreciated.

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

0

I figured it out. I had both the src and index.js in a server file. In the package.json file I both the src/index.js to server/src/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!