I was trying to setup my Ubuntu 20.04 to run my expressJS server but this error is not letting me do that. So here is the whole problem:
package.json
is:{
"name": "server",
"module": "index.ts",
"type": "module",
"devDependencies": {
"@types/bcrypt": "^5.0.2",
"@types/bun": "latest",
"@types/cors": "^2.8.17",
"@types/express": "^5.0.0",
"@types/jsonwebtoken": "^9.0.7",
"@types/multer": "^1.4.12"
},
"scripts": {
"dev": "bun --watch src/index.ts",
"build": "tsc"
},
"peerDependencies": {
"typescript": "^5.6.3"
},
"dependencies": {
"@types/dotenv": "^8.2.3",
"@types/express-rate-limit": "^6.0.2",
"@types/pg": "^8.11.10",
"axios": "^1.7.9",
"bcrypt": "^5.1.1",
"cloudinary": "^2.5.1",
"cookie-parser": "^1.4.7",
"cors": "^2.8.5",
"csv-parser": "^3.1.0",
"dotenv": "^16.4.7",
"express": "^4.21.2",
"express-rate-limit": "^7.5.0",
"helmet": "^8.0.0",
"jsonwebtoken": "^9.0.2",
"mongoose": "^8.9.3",
"multer": "^1.4.5-lts.1",
"ngrok": "^5.0.0-beta.2",
"pg": "^8.13.1"
}
}
When I am running the command: bun run dev
. I am getting the output as:
I know that the first step to debug this is to check the port if someone using it or not. Here are the outputs for that:
i.e. No one is using this port.
There are also no zombie processes using this port.
And even if I change this port. This same error persists.
But nothing above is working as of now.
If you don't have IPv6 configured or no default route for it, and your /etc/hosts
contains an entry aliasing ::1
to localhost
, this Bun issue suggests that you'll get EADDRINUSE
and recommends trying to bind to 127.0.0.1
to explicitly bind to the IPv4 localhost address, or removing the line ::1 localhost
from /etc/hosts
(requires sudo
).