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

JavaScript

I'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

Hey 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:

  1. Install nodeJS (If you're on a mac, use Homebrew)
  2. Install http-server globally using npm
  3. cd into the root of the project directory
  4. 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)
  5. 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)

Mikis, thanks for the awesome comment, man, I took a screenshot so I can refer to it for the coming videos or future React projects!

Whoa!!! I went ahead and tried it and it's AWESOME! Thanks again! Now I can actually follow along exactly with the video! Woohoo!

Glad it worked out for you, man.

Chrome 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.

Thanks, I went ahead and set it up using react-router, and I'm good to go, running it on localhost.