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 trialAdan Camacho
17,567 PointsI'm on "Our First Application" in the React course. Downloaded the project files and all I get on Chrome is "loading."
This is the error I get in the console on Chrome: "babel-browser.min.js:4 XMLHttpRequest cannot load file:///Users/adancamacho/Dropbox/Programming/Treehouse/React/ReactBasicsProject/app.jsx. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource."
Firefox works fine.
3 Answers
miikis
44,957 PointsHey Adam,
Using react-router as a simple server is akin to killing an ant with a bazooka. Instead, I would suggest you do the following things, in the following order:
- Install nodeJS (If you're on a mac, use Homebrew)
- Install http-server globally using npm
- cd into the root of the project directory
- run hs . anytime you want to start your simple server
(It used to be that you could pass this command a
-o
flag and it would open your default browser for you, but, as of the time of this writing, that functionality is annoyingly buggy) - open your browser to localhost:8080 or 10.0.0.7:8080 (The latter address is the one you want to use if you're trying to view the app via another device via your wifi)
Dustin Brown
2,433 PointsChrome has more strict security around Cross origin requests, especially when reading from the local file structure. If you were to serve up your local file with a web server (I personally like using the Ruby gem Serve for this), then it should work in any browser without a problem.
Adan Camacho
17,567 PointsThanks, I went ahead and set it up using react-router, and I'm good to go, running it on localhost.
Adan Camacho
17,567 PointsAdan Camacho
17,567 PointsMikis, thanks for the awesome comment, man, I took a screenshot so I can refer to it for the coming videos or future React projects!
Adan Camacho
17,567 PointsAdan Camacho
17,567 PointsWhoa!!! I went ahead and tried it and it's AWESOME! Thanks again! Now I can actually follow along exactly with the video! Woohoo!
miikis
44,957 Pointsmiikis
44,957 PointsGlad it worked out for you, man.