adrianhajdin/project_ai_mern_image_generation

[nodemon] app crashed - waiting for file changes before starting...

Ramzy70 opened this issue · 4 comments

server@1.0.0 start
nodemon index.js

[nodemon] 3.0.1
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting node index.js
node:events:491
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE: address already in use :::8080
at Server.setupListenHandle [as _listen2] (node:net:1485:16)
at listenInCluster (node:net:1533:12)
at Server.listen (node:net:1621:7)
at Function.listen (D:\z_Dev\MERN\ai_image\server\node_modules\express\lib\application.js:635:24)
at startServer (file:///D:/z_Dev/MERN/ai_image/server/index.js:16:9)
at file:///D:/z_Dev/MERN/ai_image/server/index.js:18:1
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async loadESM (node:internal/process/esm_loader:91:5)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1512:8)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 8080
}

Node.js v18.12.1
[nodemon] app crashed - waiting for file changes before starting...

how can i resolve this, i am around 1:04:48 in the video

MONGODB_URL="mongodb+srv://<userID>:<password>@dallecluster.swczd9x.mongodb.net/retryWrites=true&w=majority"

Replace your user ID and Password there and don't add extra spaces anywhere in this file

i didn't reach that point yet, i am still at 1:04:48 in the video

the index file look like this :

import express from 'express' ;
import * as dotenv from 'dotenv';
import cors from 'cors';

dotenv.config();

const app = express();
app.use(cors());
app.use(express.json({ limit: '50mb' }));

app.get('/', async (req, res) => {
res.send('Hello from Dall-E');
});

const startServer = async () => {
app.listen(8080, () => console.log('Server has started on port http://localhost:8080'));
};
startServer();

You had run another server use the same port like 8080.

Maybe you had run node app in other shell, Please close it and run again.

thanks, i tried with 5000 and it worked