Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

248
Vistas
when i use uuid the code unexpected crash, and then works fine?
const express = require('express');
const { uuid } = require('uuidv4');


const app = express();

app.use(express.json())

const projects = [];

app.post('/projects', (req,res)=>{

 const { title, owner } = req.body;
 
  const project = { id: uuid() , title, owner };
  projects.push(project);

  return res.json(project)
})

app.listen(6690, ()=>{
  console.log('Started!👌');
});

when i execute nodemon:

[nodemon] restarting due to changes...
[nodemon] starting `node src/index.js`
node:events:498
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::6690
    at Server.setupListenHandle [as _listen2] (node:net:1330:16)
    at listenInCluster (node:net:1378:12)
    at Server.listen (node:net:1465:7)
    at Function.listen (C:\Users\Lord\desktop\projetos\bootcamp\backend\node_modules\express\lib\application.js:618:24)
    at Object.<anonymous> (C:\Users\Lord\desktop\projetos\bootcamp\backend\src\index.js:21:5)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1357:8)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'EADDRINUSE',
  errno: -4091,
  syscall: 'listen',
  address: '::',
  port: 6690
}
[nodemon] app crashed - waiting for file changes before starting...

but if i update one more time, works fine:

[nodemon] restarting due to changes...
[nodemon] starting `node src/index.js`
Started!👌

if i update one more time, and one more time and... will happen all over again node v16.14.0 nodemon v2.0.14

if i update one more time, and one more time and... will happen all over again node v16.14.0 nodemon v2.0.14

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

From your logs, the first problem that comes to mind is that your nodemon is not existing gracefully when it is stopped or waiting, hence the port already used error. According to this thread it is possible to add in hooks to force nodemon to handle specific events and auto kill processes before it runs again.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda