- Newest
- Most votes
- Most comments
So this morning I restarted the lightsail instance. Following the instructions set by Ibrahim I first checked running applications. None appeared to be running.
Moving to my sample directory (all of this was already installed by the instance startup). I re-ran the startup instructions.
bitnami@ip-xx:$ netstat -ant | grep 8080
bitnami@ip-xx:$ netstat -ant | grep 3000
bitnami@ip-xx:$ dir
bitnami_application_password bitnami_credentials htdocs stack
bitnami@ip-xx:$ cd stack
bitnami@ip-xx:/stack$ dir
apache apps bncert-tool bndiagnostic-regex.ini common gonit licenses nami php projects scripts var
apache2 bncert bndiagnostic bndiagnostic-tool ctlscript.sh letsencrypt mariadb peclapcu phpmyadmin properties.ini stats varnish
bitnami@ip-xx:/stack$ cd projects
bitnami@ip-xx:/stack/projects$ dir
node_modules package-lock.json sample
bitnami@ip-xx:/stack/projects$ cd sample
bitnami@ip-xx:/stack/projects/sample$ dir
app.js bin node_modules package.json package-lock.json public routes views
bitnami@ip-xx:/stack/projects/sample$ npm install
up to date, audited 136 packages in 1s
17 packages are looking for funding
run npm fund
for details
found 0 vulnerabilities bitnami@ip-xx:~/stack/projects/sample$ DEBUG=sample:* ./bin/www sample:server Listening on port 8080 +0ms
GET / 200 268.998 ms - 170 GET /stylesheets/style.css 200 3.987 ms - 111 GET /favicon.ico 404 12.913 ms - 1102 GET / 200 10.040 ms - 170 GET /stylesheets/style.css 200 0.783 ms - 111 GET /darkArx/about.css 404 9.282 ms - 1102 GET /Assets/Video/world.mp4 404 15.334 ms - 1102
As you can see the express is running on 8080.
However, my file in ./bin/www has this in it?
var port = normalizePort(process.env.PORT || '3000'); app.set('port', port);
which would I assume try and set the port to 3000? Why then is it running on 8080?
Many thanks in advance of your answers.
Chris
Based on the error message, it seems another process is already bound to port 8080 on your server, preventing your Node.js application from starting on that port. A few things you could try:
- Check if another Node.js process is already running on port 8080 using
netstat -ant | grep 8080
. If so, you'll need to stop that process first before starting your app. - Configure your app to listen on a different port. Edit the
bin/www
file and change the port, e.g.app.listen(8081)
. - If using Docker, make sure no other containers are bound to 8080 using
docker ps
. You may need to specify a unique port when running the container. - Check for any processes listening on 8080 using your process manager (PM2, forever etc). Restarting these may free up the port.
- As a test, try stopping all processes with
lsof -i :8080
and then restarting your app.
Let me know if checking for other processes on 8080 or changing the app port works! Configuring unique ports is generally good practice to avoid port conflicts when deploying Node apps.
Relevant content
- client vpn(mac) said "The VPN process failed to start the port is already in use by another process"Accepted Answerasked a year ago
- asked 5 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 10 months ago
To diagnose further, you can:
The AWS documentation for their implementation of Bitnami in Lightsail is simply appalling. It's obvious that some work has been done on implementation and the images used to create the lightsail component. But the documentation is woefully out of date and leading to lots of time being wasted in clearing up confusion. AWS needs to do better.