Cannot read properties of undefined ('reading _psychoJS')

URL of experiment: https://run.pavlovia.org/Josh717717/low_effort_new_type

Description of the problem:
I have looked through similar error topics, see: https://discourse.psychopy.org/t/type-error-cannot-read-property-psychojs-of-undefined/12291

With no success.

My error message in Microsoft Edge is this:
Unfortunately we encountered the following error:

  • TypeError: Cannot read properties of undefined (reading ‘_psychoJS’)

Try to run the experiment again. If the error persists, contact the experiment designer.

This experiment has been entirely created in PsychoPy builder.

Here is a screen shot of the console in Microsoft Edge:

In Chrome I am getting a slightly different error message:
caught SyntaxError: Unexpected token ‘<<’ Josh717717/low_effo…-%20Low1111.js:3158

This is the section of the code it is referring to within Chrome - this is also within the begin routine tab in my PsychoPy Builder:
function distance(x1, y1, x2, y2) {
return Math.sqrt((Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2)));
}

function getRandomArbitrary(min, max) {
  return Math.random() * (max - min) + min;
}

img_close_initial_pos_x = [];
img_close_initial_pos_y = [];
img_far_initial_pos_x = [];
img_far_initial_pos_y = [];
landing_spot_pos_x = [];
landing_spot_pos_y = [];
landing_spot_pos_x.push(0);
landing_spot_pos_y.push(-0.45);
// Assign SchoolImage_4 to landing_spot
landing_spot = SchoolImage_4;

x_range = [-0.7, 0.7];
y_range = [-0.3, 0.4];
holdall_x = getRandomArbitrary(...x_range);
holdall_y = getRandomArbitrary(...y_range);
img_close_y = holdall_y
img_close_x = holdall_x;
img_far_x = (holdall_x + 0.2);
img_far_y = (holdall_y + 0.2);
if (img_close_x > 0.7) {
    img_close_x = 0.7;
} else {
    if (img_close_x < -0.7) {
        img_close_x = (-0.7);
    }
}

if ((img_far_x > 0.7)) {
img_far_x = 0.7;
} else {
if (img_far_x < -0.7) {
img_far_x = -0.7
}
}
while (true) {
img_close_y = getRandomArbitrary(-0.3, 0.0);
img_far_y = getRandomArbitrary(0.0, 0.45);
if (img_close_y > 0.4) {
img_close_y = 0.4;
} else {
if (img_close_y < -0.3) {
img_close_y = -0.3;
}
}
if ((img_far_y > 0.4)) {
img_far_y = 0.4;
} else {
if ((img_far_y < 0.0)) {
img_far_y = 0.0;
}
}
result_close = distance(landing_spot_pos_x[0], landing_spot_pos_y[0], img_close_x, img_close_y);
result_far = distance(landing_spot_pos_x[0], landing_spot_pos_y[0], img_far_x, img_far_y);
if ((result_far > result_close)) {
break;
}
}
img_close = new visual.ImageStim(psychoJS.window, {“image”: “images/holdall_case.png”, “pos”: [img_close_x, img_close_y], “size”: [0.2, 0.2]});
img_far = new visual.ImageStim(psychoJS.window, {“image”: “images/same_books_heavy.png”, “pos”: [- img_far_x, img_far_y], “size”: [0.2, 0.2]});
img_close_initial_pos_x.push(img_close_x);
img_close_initial_pos_y.push(img_close_y);
img_far_initial_pos_x.push(- img_far_x);
img_far_initial_pos_y.push(img_far_y);
trialClock = new core.Clock();
start_time = trialClock.getTime();
speed = 0.01;
spacebar_count = 0;
spacebar_presses = 0;
item_landing_times = ;
spacebar_press_times = ;

It says the error is on line 3158, however even after adjusting the code, it still says 3158 - even if there is different code on this line. I am not sure if this bit of information is relevant/helpful.

This experiment works perfectly in PsychoPy builder and logs data exactly how I need it to.

I am new to querying on here, so if I have missed anything please let me know and I will send it.

Thanks,

Josh Shepherd.