Need help with adding p5.js to my Glitch project

Hello everyone who’s reading this forum post, hope you’re having a fantastic day! I’m currently working on a game that uses p5.js and normal HTML5 Canvas but p5.js wont work in my project for some odd reason. It works on my own local server that runs on my machine but it doesn’t work in my helloexpress-project unfortunately. Glitch responds with a 200 OK status (which means that the CDN were found and attached to the document) but the library does not work. So my question is, how do I make p5.js work in my glitch project? I’ve tried using CDN and downloading & uploading p5.js to my project.

Link to the project: https://glitch.com/~fine-dishes

Hi @tristanmvh! Welcome to the Glitch forum! I took a look at your project – the good news is, you’re successfully loading p5 right now in your project. When I looked at what you have right now, p5 is definitely running, and so is your main.js script – it looks like line 8 of main.js is throwing an error.


I’m guessing that that error is preventing the setup() function from completing.

I fixed it! Thank you(:! I forgot to create a div tag and name it to drawing (<div id="drawing"></div>) so that’s why there was an error on line 8 in main.js.

Amazing! Share your project in #the-gallery when you’re done, I’m excited to see it :slight_smile: