Nebulocity Posted July 16, 2014 Share Posted July 16, 2014 I built the game from LessMilk's "Discover Phaser" eBook, and it went great. It runs fine using the Mongoose web server on my home PCIt runs fine IIS at work (lunchtime fun)It runs fine hosted off of Google Drive...It fails to run when hosted on my site (through Arvixe.com). Being extremely new to using JSON, I wanted to see if I could get some assistance from folks who had more experience with loading JSON files (through Phaser, as it's a Phaser error), before I contacted my host to find out if the error could be on their side (maybe they block JSON?). When I try to run the game, I get the following two errors:Error: http://literaryhodor.us/games/superyenman/phaser.min.js is being assigned a //# sourceMappingURL, but already has one "Phaser v2.0.6 - Renderer: WebGL - Audio: WebAudio - http://phaser.io" phaser.min.js:8SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data phaser.min.js:14The first error about "sourceMappingURL" only happens when using phaser.min.js.The second error about JSON.parse happens with both phaser.min.js and phaser.js.I'm not sure what else to do to try fixing this. As I said, it works at 3 other locations, and fails at one. If this is a hosting issue, I can't call them until tomorrow, which is why I'm checking here to be absolutely sure. Links, in case anyone wants to help troubleshoot. Just for kicks, I uploaded the final code for the game from the book, untouched by me, and it still throws a fit:Google Drive (works): http://bit.ly/1nH8Rn2Hosted Site (fails): http://literaryhodor.us/games/superyenman/Hosted Site [code from book] (fails): http://literaryhodor.us/games/chapter-7/Any help would be appreciated. Edit: Apparently I cannot upload JSON files (not sure why I expected it to work, lol), so here's the file's contents.{ "backgroundcolor":"#4b57ff", "height":17, "layers":[ { "data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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ayer", "visible":true, "width":25, "x":0, "y":0 }], "orientation":"orthogonal", "properties": { }, "tileheight":20, "tilesets":[ { "firstgid":1, "image":"tileset.png", "imageheight":20, "imagewidth":40, "margin":0, "name":"tileset", "properties": { }, "spacing":0, "tileheight":20, "tilewidth":20 }], "tilewidth":20, "version":1, "width":25} Link to comment Share on other sites More sharing options...
lewster32 Posted July 16, 2014 Share Posted July 16, 2014 When the error is at line 1 column 1 that usually points to an encoding issue. Try changing the encoding of the file to UTF-8 or, if it's already UTF-8, try ANSI (though it should be UTF-8 for JSON, some people have found it not to work for them). Nebulocity 1 Link to comment Share on other sites More sharing options...
marvster Posted July 16, 2014 Share Posted July 16, 2014 When I try, I will get:GET http://literaryhodor.us/games/superyenman/assets/map.json 404 (Not Found) Uncaught SyntaxError: Unexpected token < It seems reasonable, as the server will respond with html-content when file not found, cause it's not on the server. Nebulocity 1 Link to comment Share on other sites More sharing options...
Nebulocity Posted July 17, 2014 Author Share Posted July 17, 2014 Lewster32, Marvster, thank you both for your input. I tried the three available (ISON, UTF, and ANSI) and none of the three resolved the issue. I ended up contacting the hosting company, and as it turns out, they don't have a MIME type in the web.config for JSON unless it is requested...after I submitted the ticket, 30 minutes went by and I got a response with a screenshot of the game working! ;-) So, I guess we can add that to the list of troubleshooting steps if anyone else has issues...add a MIME type permission in the web.config for JSON files, and you're good to go! Link to comment Share on other sites More sharing options...
uyerdna Posted August 23, 2015 Share Posted August 23, 2015 Nebulocity, firstly sorry for butting in for such a irrelevant problem, but I thought you should know your game suffers the same problem with my problem from here. The game won't load audio files properly on SafariPhaser.Loader error loading file: bgm from URL nullPhaser.Loader error loading file: jump from URL nullPhaser.Loader error loading file: coin from URL nullPhaser.Loader error loading file: dead from URL nullFollowed by TypeError: 'undefined' is not an object (evaluating 'this.masterGain.gain') Link to comment Share on other sites More sharing options...
Recommended Posts