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

Downloadable project files do not run. Error: Cross origin requests are only supported for protocol schemes:

I'm trying to run this locally so I downloaded the files but they don't run in the browser. Console shows this error:

Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

1 Answer

Seth Kroger
Seth Kroger
56,371 Points

Yeah, the project is meant to be run from Workspaces or an HTTP server. If you want to run it locally I'd suggest using NodeJS in the Terminal/Command Line (which you'll need for subsequent courses anyway) and installing http-server the globally. Then you can run the command in the directory and it will a mini server to serve the files and satisfy the CORS rules.

npm install -g http-server

http-server

Thank you!

Hazel Parreno
Hazel Parreno
18,646 Points

Thanks! I had the same problem and is now working.