Jump to content

MelonJS sample source not working


Recommended Posts

Hi there, I've installed the MelonJS Platform tutorial exactly as described, and unfortunately it is not working.

at first it needs a bunch of grunt files installed, so I've done that now I just get a black screen (and melonJS won't load) on localhost:8000

the only error is see when running npm run serve is

"Local Npm module "grunt-asar" not found. Is it installed?"

can anyone help me? It's really unfortunate to see the MelonJS Platform broken like this.

I did install it a few years ago successfully, but something now is so wrong! Can anyone help me figure out what I'm doing wrong?





Link to comment
Share on other sites

Hi, Again with this error ! (facepalm)

are you using the latest version of the boilerplate ? this was addressed in the latest commits (https://github.com/melonjs/boilerplate/commits/master)

see as well here :



but yes the boilerplate really/definitely needs a big update (remove grunt) and switch to either webpack or rollup 

Link to comment
Share on other sites

Yes, even if you download the lastest boilerplate,

it still comes up with (on npm install)

npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/bwin/grunt-asar.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.


I tried reading the link you posted above. still doesn't work. (I followed the steps exactly)

Really would like to be able to play with melon.js but man, is this difficult when nothing works!!!!


Can you not just post a working MelonJS platform tutorial?  Or post one without the 

grunt-asar that actually works?


Thanks in advance for your help, I think melonjs is awesome as I used it years ago (also that one installed easy back then)

so surprised I can't even get the MelonJS Platform tutorial to work at all!!!!

Link to comment
Share on other sites

just to be clear though, the build process in the boilerplate is to actually build a one file minified version of the game, and additionally automatically generate the asset file.

nothing prevent from actually using the boilerplate "manually" by running the provided index html file, without building the whole thing (or even just not using the boilerplate, it's not mandatory) and manually building the resources file yourself :




Edited by obiot
Link to comment
Share on other sites

Ok making a bit of progress... I can get the maincharacter to appear (but falls right off the screen) -- -so now I'm trying to put in a collision layer - but when I edit the map file and put a rectangular collision as you see in the screenshot melonjs won't load my character won't appear and melonjs won't load (it crashes)

(but doesn't throw any errors) obviously an issue with the tiled file - can anyone see why the collision layer at the bottom would prevent MelonJS from loading at all?

That collision layer in picture below works with the top two collision rectangles but not when I try and add the bottom one.

Any idea why?



Link to comment
Share on other sites

  • 4 weeks later...

Ok new issue now, I can't get the background and foreground to show when running the tutorial.

Is there not somewhere where working source code for the platform tutorial can be downloaded?

This is so frustrating! I think melonJS is great but spending countless hours just trying to get the tutorial to even run is ridiculous!

Link to comment
Share on other sites

Also noticed it has the .png for the tilemap is not a POT texture and it also throws the error:

Computed tilecount (160) does not match expected tilecount (140)


These two errors are probably the reason foreground and background won't show up.

Also in good news, the maincharacter does work and is displayed!

Link to comment
Share on other sites

in the Tiled screenshot here above, your foreground layer is marked as hidden (see the closed eye), are you sure this is not a setting "issue" in tiled ? the error you mentioned is just actually a warning, but it does not prevent the the texture from being used. We display warning about non-POT texture as it impacts performances with WebGL, but does not prevent the game from working.

also, if you are on the latest 8.x version, you can actually enable WebGL2 that now accepts non-POT, by setting the preferWebGL1 flag to false :



Else the whole tutorial source code is available on GitHub :



I understand your frustration, but the tutorial is not only about melonJS, it's also about the 3rd party tools (like Tiled), and yes it's easy to make a mistake, and yes it's definitely a learning process.


keep us updated on your progress, and do come back here if you need more help :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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