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

282
Views
MongoDB/React Error: listen EADDRINUSE: address already in use :::5000

I am following this MERN tutorial: https://www.youtube.com/watch?v=ngc9gnGgUdA Around @18:00 is where I am having problems. After some research I think some of the code in the video is outdated and I am doing my best to get this to work! This is my current error: Error: listen EADDRINUSE: address already in use :::5000

import express from 'express';
import bodyParser from 'body-parser';
import mongoose from 'mongoose';
import cors from 'cors';

import postRoutes from './routes/posts.js';


const app = express();

app.use('/posts', postRoutes);
 

app.use(bodyParser.json( { limit: "30mb", extended: true}));
app.use(bodyParser.urlencoded( { limit: "30mb", extended: true}));

app.use(cors());

const CONNECTION_URL = 'mongodb+srv://test:test123@cluster0.mql8u.mongodb.net/myFirstDatabase?retryWrites=true&w=majority';
const PORT = process.env.PORT || 5000;


mongoose.createConnection(CONNECTION_URL).asPromise();

mongoose.connect(CONNECTION_URL)
.then(() => app.listen(PORT, () => console.log(`server running on port: ${PORT}` )))
.catch((error) => console.log(error.message));

I SUPER appreciate any and all help. If anyone can point me in the direction of a better tutorial that would be amazing! I am a novice code, I finished a virtual coding bootcamp recently, but I need to make some real apps. Thanks again!

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

0

First I would check and see if you already have something running on port 5000, to confirm, I would run npx kill-port 5000, then try to run port 5000 again to see if that port is now free after killing it via the previously noted command...

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!