Running p5.js sketch error

when i try to launch my sketch (P5.JS libarary used) i get this error in the console:

java.lang.NullPointerException
at processing.mode.p5js.p5jsBuild.updateHtml(p5jsBuild.java:103)
at processing.mode.p5js.p5jsEditor.handleRun(p5jsEditor.java:438)
at processing.mode.p5js.p5jsToolbar.handleRun(p5jsToolbar.java:32)
at processing.app.ui.EditorToolbar$1.actionPerformed(EditorToolbar.java:157)
at processing.app.ui.EditorButton.mousePressed(EditorButton.java:189)
at java.awt.Component.processMouseEvent(Component.java:6530)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4523)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

please help, i am kinda new to p5.js.

You may try out OpenProcessing instead: :cowboy_hat_face:
https://OpenProcessing.org/sketch/create

Or simply use any Firefox-based browser to open your “index.html” file: :money_mouth_face:

You can use this minimal “index.html” template btW: :innocent:

<script defer src=https://CDN.JsDelivr.net/npm/p5></script>
<script defer src=sketch.js></script>

ok, ill test firefox and the script thingy.

and btw heres my source code please help i am trying to make a snake game i am stuck at the controlls for moving

var s;

function setup() {
createCanvas(600,600)
s = new snake();
}

function draw() {
background(51);
s.show();
s.update();

}
function snake() {
this.x = 0;
this.y = 0;
this.xspeed = 1;
this.yspeed = 0;
this.update = function() {
this.x = this.x + this.xspeed;
this.y = this.y + this.yspeed;
}
this.show = function() {
fill(255)
rect(this.x, this.y, 10, 10);
}
}

function KeyPressed() {
if (keyCode === UP_ARROW) {
s.dir(0, -1);
} else if (KeyCode === DOWN_ARROW) {
s.dir(0, 1);
} var s;

}
function snake() {
this.x = 0;
this.y = 0;
this.xspeed = 1;
this.yspeed = 0;
this.update = function() {
this.x = this.x + this.xspeed;
this.y = this.y + this.yspeed;
}
this.show = function() {
fill(255)
rect(this.x, this.y, 10, 10);
}
}

function KeyPressed() {
if (keyCode === UP_ARROW) {
s.dir(0, -1);
} else if (KeyCode === DOWN_ARROW) {
s.dir(0, 1);
}var s;

function setup() {
createCanvas(600,600)
s = new snake();
}

function draw() {
background(51);
s.show();
s.update();

}
function snake() {
this.x = 0;
this.y = 0;
this.xspeed = 1;
this.yspeed = 0;
this.update = function() {
this.x = this.x + this.xspeed;
this.y = this.y + this.yspeed;
}
this.show = function() {
fill(255)
rect(this.x, this.y, 10, 10);
}
}

function KeyPressed() {
if (keyCode === UP_ARROW) {
s.dir(0, -1);
} else if (KeyCode === DOWN_ARROW) {
s.dir(0, 1);
} else if (KeyCode === RIGHT_ARROW) {
s.dir(1, 0);
} else if (KeyCode === LEFT_ARROW) {
s.dir(-1, 0);
}
}