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 trialL Haney
Front End Web Development Techdegree Student 10,263 Pointshttp-server not working for me either
I started with... $ npm install http-server -g
first attempt to get it to work... $ http-server my_project
second attempt ... $ http-server C:\Users\leemsy\Desktop\my_project
third attempt ... $ http-server "C:\Users\leemsy\Desktop\my_project"
fourth attempt ... $ http-server C:\Users\leemsy\Desktop\my_project\index.html
Nothing works.
2 Answers
L Haney
Front End Web Development Techdegree Student 10,263 PointsFound the problem: https://stackoverflow.com/questions/56364464/http-server-with-localhost3000-gives-err-invalid-redirect
"Try downgrading the http-server version as the latest version (0.10.0 and 0.11.0) is causing issue due to ecstatic (3.3.2). Try uninstalling the current http-server version and then try to install 0.9.0 or older version." $ npm uninstall -g http-server $ npm install http-server@0.9.0
Also, make sure you install the server in the directory the website will be run out of. ;)
L Haney
Front End Web Development Techdegree Student 10,263 PointsHere is what I did.
1.) I created a new directory (in my Desktop directory) called "my_project" that contains an index.html file.
2.) I located to the "my_project" directory in windows powershell and typed
npm install http-server@0.9.0
3.) I typed in node and the entire path to the http-server file.
node C:\Users\leemsy\Desktop\my_project\node_modules\http-server\bin\http-server
4.) Then I saw this ... http://156.166.1.36:8080 http://101.156.1.56:8081
Type http://156.166.1.36:8080/index.html into your browser and the page should come up. Be sure to refresh the page.