JavaScript React Basics (retired) First Steps in React Our First Application

Jason Brown
Jason Brown
9,626 Points

Cannot view app in browser, even from final result download files.

I've tried everything I can think of. I've even tried just downloading the completed project and tried getting it to load. But no dice. I keep getting this message:

XMLHttpRequest cannot load file:///Users/siouxr/Desktop/ReactBasicsProject%20(1)/app.jsx. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. transform.load @ babel-browser.min.js:4

Any help would be greatly appreciated.

2 Answers

Carlos Villarroel
Carlos Villarroel
23,748 Points

Hey Jason,

A really easy fix is to install the pkg 'http-server' with npm (which means you should have Node.js and npm installed in your machine); then start the server from your working directory and your app will load.

Tom Bedford
Tom Bedford
15,645 Points

Hi Jason, I initially ran into the same issue as you. To use the code on your computer you need to be running it from a localserver rather than directly from the file, you can do this with a program like MAMP or a command line tool.

Alternatively, you can click on "Launch Workspace" during the video and it will open a window where you can follow along in the browser. Here is some information about Treehouse Workspaces. You can also test the code using CodePen.