Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Host Phaser Game on GitHub


Larry
 Share

Recommended Posts

This is my first time hosting a game. I have all the files up on GitHub and they all work when I run them locally, but when I go to the GitHub link I get these errors:

Failed to load resource: the server responded with a status of 404 () - phaser.min.js

Uncaught ReferenceError: Phaser is not defined at main.js:3

Link to comment
Share on other sites

The url to the Phaser min file is probably broken due to differences when you have it launched locally - check ./phaser.js vs /phaser.js vs phaser.js for example, or if the game files ended up in a folder because of the user.github.io/repo-name/index.html structure. Or paste the link to the game so we can help you.

Link to comment
Share on other sites

Yeah, paste a url to your github source. It's likely just a pathing issue, try to relative paths from the index.html when using github hosting.

It's also worth automating this using something like gh-pages. I normally have it hooked up to a build process (if you use one) as the final step. What is super good about this is that there are lots of other tools (like apex.sh, netlify or now.sh) that work in the same way so when you want to scale up and host elsewhere you can normally just do a one-line change in that last deploy step or be smarter and have dev/latest/nightly builds go to github and real prod builds go elsewhere.

Link to comment
Share on other sites

  • 2 years later...

Hey Larry! 

Do you remember how you were able to fix it? :)

I am having this issue too with a site deployed here: https://everybodycodes.github.io/Phaser-Fish-Game/

It's looking for the loaded files at the wrong location and not including the "Phaser-Fish-Game/" directory in the path...

I think there needs to be some flag to pass into the `phaser-scripts build` command, but sadly I don't see one... 😢

I would really be a bad developer experience if you are forced to manually go through and modify every file path mention in the build folder again each time you make a build!

 

I also opened an issue about this here: https://github.com/photonstorm/phaser/issues/5083

 

And I asked about this on the phaser forums too: https://phaser.discourse.group/t/errors-when-trying-to-host-on-gh-pages/5832

Edited by Jimaginary
Link to comment
Share on other sites

  • 1 year later...

Hi, I am trying to host a Phaser 3 game on heroku or netlify. I faced a broken link. I don't know where I got wrong. I will appreciate your help.

Thank you.

See a link to my github profile: https://github.com/happiguru/Game-JavaScript/tree/setup

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...