Unable to deploy express.js project: EADDRINUSE: address already in use
Hello, I was trying to deploy a new service consisting of a express.js server and was having trouble getting it to deploy. I have another service that is also using express that is working perfectly fine, and I have this one setup in the exact same way (using the PORT env to listen on) but this one seems to have trouble listening on any given port. I have also tried specifying 0.0.0.0 with no luck. Thanks in advance!
Error log:
Express server code:
Project ID:
ed6d3edc-13cb-4f94-98af-04578f1a1a67
Solution:Jump to solution
can you start your astro app with the node adapter instead of trying to serve it with express
16 Replies
Project ID:
ed6d3edc-13cb-4f94-98af-04578f1a1a67
can you share your repo?
GitHub
GitHub - Ooglely/pugbot.tf
Contribute to Ooglely/pugbot.tf development by creating an account on GitHub.
have you set a custom start command anywhere?
Yeah, in the project I have the build command set to
npm install; npm run build
and start command to node start.js
remove both build and start commands from the service settings.
set your start script in your package.json to
node start.js
Still the same error unfortunately
build logs please https://bookmarklets.up.railway.app/log-downloader/
and deploy logs too?
Deploy log is just this repeated
Before removing the custom start/build commands the
npm WARN config production Use --omit-dev instead.
line was not thereSolution
can you start your astro app with the node adapter instead of trying to serve it with express
oh my god. I forgot to switch mode in
astro.config.mjs
to middleware instead of standalone, thats why the address was already in use
unbelievable i knew it was something stupid, thank you so much for your help
i was truly stumpedyeah i knew astro was trying to run a server too, thats why i asked you to just use its server instead of express
worked locally though, so strange
again thank you so much
no problem!