Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Francis N
10,376 PointsExpress and Localhost ports.
I had a express project (Project1) that I was working on my local machine. Express by default sets up localhost:3000 as the port number to view your project via browser. Right now, I am trying to work on a new express project and when I use npm start in my terminal for Project2, I get an error saying Port 3000 is already in use.
I don't know too much about localhost other than getting them assigned to a specific project on your local machine to view it.
How do I end/kill Project1 on localhost:3000 so that I can view Project2? I think I read somewhere that Express by default can only listen on localhost:3000, can that be changed? If so, how?
And lastly, why localhost: 3000, 8000, 8080? Can localhost port numbers be anything (like 3010, 3443, 3333, etc)?
1 Answer
Francis N
10,376 PointsI did not realize that I had a terminal up and running on Project1. That fixed the problem of Project2 not working on localhost:3000 but it now is. I just closed the node terminal that was running Project1. I still don't understand localhost and would love to learn more why 3000, 8000, 8080, etc.
Also, is there somewhere we can check to see to see which port is open/used?