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 trialAngelic Sanoy
Full Stack JavaScript Techdegree Student 6,743 PointsI downloaded the Introducing Javascript project. When I open the index.html. Nothing works. Any idea?
I downloaded the Introducing Javascript project. When I open the index.html. Nothing works. Any idea?
2 Answers
Unsubscribed User
15,444 PointsSo if you load up the page, and open up the console, you'll probably see an error similar to below:
Uncaught DOMException: Failed to execute 'texImage2D' on 'WebGLRenderingContext':
The image element contains cross-origin data, and may not be loaded.
There's an entire world of Cross Origin Resource Sharing (CORS) - but that's definitely out of score for this course!
To get the code up and running, the easiest way is to run it locally on your machine. This sounds like it would take a lot of effort, but can be done in a matter of seconds using python's SimpleHTTPServer.
To do this:
- Launch a terminal window.
- Switch to the directory containing the files you wish to run locally
(e.gcd ~/Desktop/introducing_javascript/bonus_game
) - Then run the following command:
python -m SimpleHTTPServer 8000
- Open up your browser and navigate to
http://localhost:8000/
and the everything should be running!
Hope this helps!
Regards
Berian
Unsubscribed User
15,444 PointsAhh that's because Python hasn't been added the Windows PATH. I'm on Mac, so python kind of just works here.
If you've already installed Python 2.7 then you need to follow these instructions:
- Open System Properties (Right click Computer in the start menu, or use the keyboard shortcut Win+Pause)
- Click Advanced system settings in the sidebar.
- Click Environment Variables...
- Select PATH in the System variables section
- Click Edit
- Add Python's path to the end of the list (the paths are separated by semicolons). For example:
C:\Windows;C:\Windows\System32;C:\Python27
If you have installed Python 3, the installation should have included an option to add python.exe to the system search path. The SimpleHTTPServer python command is slightly different on py3 however,
python -m http.server
Hope this helps!
Angelic Sanoy
Full Stack JavaScript Techdegree Student 6,743 PointsThank you! Alternatively, I use VS but I will test this out shortly. :) Really appreciate it.
Angelic Sanoy
Full Stack JavaScript Techdegree Student 6,743 PointsAngelic Sanoy
Full Stack JavaScript Techdegree Student 6,743 PointsYes. I just use a cdn to remove the error and warnings but it index.html is still not working. Should I revert back the phaser.js? What do you think is the best approach after running the code above?
How can I make sure this works in all audience if I upload this in a live site?
Btw, thank u so much!
Angelic Sanoy
Full Stack JavaScript Techdegree Student 6,743 PointsAngelic Sanoy
Full Stack JavaScript Techdegree Student 6,743 PointsI just installed a python but it's still giving me this error? Any idea why? http://prntscr.com/m0arid