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 React Basics (2018) First Steps in React Understanding JSX

I think there is problem with react, when I open developer tool in chrome (F12) It shows 1 error

babel.min.js:24 Access to XMLHttpRequest at 'file:///C:/Users/Pilotech/Desktop/React/my-app/public/scoreboard/app.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

2 Answers

Steve Gallant
Steve Gallant
14,943 Points

Because the URI starts with "file:///C:/", I'm guessing you are browsing to your file via the local Windows file system rather than running a local http server as previously described in the course. Make sure you are accessing the page via http in your browser, usually at http://localhost:8000 for the python method. Hope this helps!

Steve

Mike Hardy
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Mike Hardy
Full Stack JavaScript Techdegree Graduate 16,511 Points

Thanks Steve. I had the same issue and following the steps for "Running a simple local HTTP server" in the Teachers notes in a previous video was the answer.

Dominique Pearyer
Dominique Pearyer
503 Points

Thank you thank you thank you! Your solution is the only one that worked and I've been searching for hours. For anyone who sees this and can't figure it out try these steps from the beginning on MacOs:

  1. Make sure you enable opening the terminal in a specific folder here's a link on how to do this (https://www.groovypost.com/howto/open-command-window-terminal-window-specific-folder-windows-mac-linux/)
  2. Open the terminal in the folder with your files in it and type "python -m SimpleHTTPServe 8000" (press enter)
  3. Open http://localhost:8000 on your browser (make sure it has http:// in front or it won't work)

thank you I did it I used wamp , and it works