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

502
Views
Node.js: Error: ENOENT: no such file or directory

I keep getting this message when I'm trying to connect to localhost:3000 (Visual Studio Code, Node JS). I am not sure how to correct this.Edit: I corrected my file to server.js but I am still getting the same message. Any help is appreciatedenter image description here!

Here is my code for server.js

const express = require('express');
const path = require('path');

let initial_path = path.join(__dirname, "public");

const app = express();
app.use(express.static(initial_path));

app.get('/', (req, res) => {
    res.sendFile(path.join(initial_path, "home.html"));
})

app.listen("3000", () => {
    console.log('listening......');
})

And my code for package.json

{
  "name": "bloggin-site",
  "version": "1.0.0",
  "main": "server.js",
  "scripts": {
    "start": "nodemon server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express-fileupload": "^1.2.1",
    "express.js": "^1.0.0",
    "nodemon": "^2.0.15"
  },
  "devDependencies": {},
  "description": ""
}
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

rename servor.js to server.js. I faced a lot when I am learning programming) Good luck bro keep it up!

about 4 years ago · Juan Pablo Isaza Report

0

It's going to be a lot of little error like this as you learn. Try to slow down and read. Your filename is servor.js enter image description here

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!