P5 crashes chrome

Whenever I try to run a p5.js sketch in chrome, whether it’s the web editor, the html file, or opening a server with the p5.js mode in processing, I get a "this application has stopped working pop-up, and all chrome windows close. I have tried reinstalling chrome, but it doesn’t work. It works on firefox, but I would prefer if i could make it work on chrome. Does anybody know how I could fix this?

There isn’t something wrong with the sketch: perhaps an infinite loop or it is running too many tasks at once for the browser to handle?

Could you give us some specs?

Please provide an MCVE. Did you run the developer tools? If something is going wrong, it should be able to tell you there. If we are able to reproduce it, then we will be able to help.

Kf

Where are the developer tools? It isn’t an infinite loop, it happens with any p5 file, including one with one setup, draw, and createCanvas.

In chrome, developers tools is accessed via ctrl+shift+I by default. You want to go to the console tab. If you refresh the page and interact witht the page, you should be able to see any messages there, even errors.

Provide the code that is giving you trouble.

Kf

Like @kfrajer mentioned, it’s really hard to help you if you don’t post your code as a minimal, complete, and verifiable example (aka an MCVE). This means debugging your code and isolating the problem into a small example that we can run ourselves to see the problem.

And yes, you should check out your developer tools to look for any errors. Shameless self-promotion: here is a guide on using your developer tools:

Although if you’re hitting an infinite loop, you probably won’t see anything here. Your best bet is to post your MCVE.

1 Like

@Kevin @kfrajer I’d like to suggest that instead of linking to an article describing an acronym, please just describe what you would like the original poster to do. Maybe there’s a way that this can be set up as a template for frequent helpers & posters. Even as an experienced contributor, I found the responses to this post unfriendly and gatekeeper-like.

@Quillbert1 is there a short, running sketch that you can paste here to help us debug the issue? Or linking to the sketch in the editor is great. Another user reported that they were using an older version of Mac OS and that they were able to get better results by upgrading their operating system. Maybe some of the debugging suggestions in this thread will be helpful: Performance issue: p5.js crushing my CPU (possible retina issue?)

2 Likes

@kjhollen Apologies. It’s easy to slip into “short answer” mode when you’re trying to reply to the number of posts we get on this forum. I’ve added some context and additional links.

And fwiw we do have this template:

@Kevin yes, keeping up with the volume is difficult. I’m grateful for the time that you’re able to spend answering so many questions! Thank you for sharing these tips with me—while these are useful and valuable, I had something else in mind.

What I mean to suggest is that maybe there’s a place we can just have some succinct, friendly responses to common post/format issues that frequent question-answerers can start with to ensure that their responses are gentle for new posters. I’m willing to spend some time on this and will think about where to keep it.

3 Likes

It doesn’t give me time to open the console, it just crashes. I am using the empty-example index.html, and the sketch file is this:

function setup() {
  // put setup code here
  createCanvas(600,400);
}

function draw() {
  // put drawing code here
}

You need to walk us through each step of what you are doing. I mean, re-installing chrome is very… odd. To be installing Chrome means to me that you are a chrome developer and something went really wrong. To solve this problemSo, let’s go back from the beginning. What Operating system are you using? What browsers do you have beside Chrome?

Now, you have and index html. Provide this code. Also show us how you add the p5.js code. Finally, how do you run it?

Notice that for this, you do not need to setup any server.

Kf

I am using windows 10. I also have internet explorer, edge, and firefox. I run the program by right clicking on the index.html file and opening with chrome. I open the sketch file with sublime text 3, edit it, and save it. The index.html code is:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0>
    <style> body {padding: 0; margin: 0;} </style>
    <script src="../p5.min.js"></script>
    <script src="../addons/p5.dom.min.js"></script>
    <script src="../addons/p5.sound.min.js"></script>
    <script src="sketch.js"></script>
  </head>
  <body>
  </body>
</html>

Chrome-allow-file-access-from-file.com

I guess i will just have to use firefox then, because command line is disabled on my computer. Thanks anyways.

Add --allow-file-access-from-files to the shortcut. No command line’s needed at all! :wink:

1 Like