Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

295
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda