TypeError: The listener must be a function index.js:60

As the title says, is there anything i can fix?, i really dont wanna touch the framework index files. that feels scary

Hi,

To help you we must examine your code.

understood, but its not my code in particular its the phaser3 index.js
the code that i havent created :stuck_out_tongue:

index.js should be your file. How do you load Phaser in html? Can you show that?

And the error is there may be because you’re not passing function as listener callback.

Yes i can show you, but im not at the pc right now.
Will be back a little later on and i Will provide screenshots

here is the code i am trying to run and error message in console, and also i see i got like 3000 different warnings regarding the framework files i downloaded ( maybe i can ignore? ) but i feel like i need some guidelines or a bump in the right dircetion here.

maybe i didnt install it properly or something?

Right now you are having some advance project setup. Maybe you’re not well aware of how this setup works and just following tutorial.

I think it is best to start with as simple setup as possible. imo best way to learn basics of Phaser is this making your first phaser 3 game tutorial.

Good luck!

TypeError: The listener must be a function

Expand the stack trace. Find the line of code of yours closest to the error. Find the function argument passed as a listener (callback). Identify the value of that argument.

I can see the issue in your first screenshot.

this.load.on('progress'), (percent) => { ... }

should instead be

this.load.on('progress', (percent) => { ... })

You’re not giving a callback to the listener in the first case, you’re just defining an anonymous function that never gets used.

1 Like