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 trialJill Lopez
405 PointsI can't get my local server to run
I followed the instructions from this site (as recommended): https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server#Running_a_simple_local_HTTP_server.
I cd into the project folder that I am in "o:\Coding\Projects\scoreboard\scoreboard>" and use the prompt "python -m http.server". When I open localhost:8080 on the browser, it says "This site cannot be reached."
4 Answers
Gabbie Metheny
33,778 PointsAnother student posted here about using http-live-server, installed through npm. It has very few downloads, though, and I'd recommend something that's been vetted. I'm using http-server because I'd already installed it in the past for other treehouse courses. You install it globally through npm (npm install -g http-server
), and then in the root of your project, all you do is run http-server
in your console. You'll get a console message telling you what port your site is running on, for me it's http://127.0.0.1:8080
. The only difference for how it's working for me vs. how Guil's server works in the videos is that I have to hard reload every time I make changes (on Chrome in Windows, with dev tools open, right click on the refresh icon, select 'Hard Reload', or just press Ctrl+Shift+R
). Hope that helps!
Zack Jackson
30,220 PointsJust posted a response in an earlier video for how I'm going about this with Node.js rather than with python. Link at the bottom.
You can run it globally or set up your project folder with npm init and then set live-server up as a devDependency and a npm script.
live-server has been around for 2 years and has several hundred thousand downloads per month. It also automatically watches and auto reloads the page which is awesome.
Hope this helps.
https://teamtreehouse.com/community/alternative-liveserver-setup
James Almeida
8,881 PointsThis also worked for me. Thanks!
Dave StSomeWhere
19,870 PointsWhen you did the python -V what did you get?
You might need to run python3 -m http.server - often python is 2.7 while python3 is 3.x
You should get something like - on my desktop it uses port 8000 as the default:
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/)
Nickolas Fuentes
14,016 PointsIf people also have another port running something.
You can try this
python3 -m http.server 7800
and it will give you another port to run it on. Also download the React Developer Tools!@
James Almeida
8,881 PointsJames Almeida
8,881 PointsThanks. This worked for me. Weird he doesn't mention how to do this in the video...
Zack Jackson
30,220 PointsZack Jackson
30,220 PointsJames Almeida He mentioned it briefly, but just kinda left it to you to follow the teacher's notes and hope for the best. In the followup course he uses the create-react-app cli which has webpack functionality and does all of this automatically.
I still use live-server a lot with projects where I don't really want to set up webpack or gulp. Super handy with the live reloading.