| Reference | Downloads | Github

'Uncaught SyntaxError' and 'Failed to load resource' error

URL of experiment:

Description of the problem:
Apologies for creating a similar post to others, but I seem to have a combination of problems and none of the suggested fixes on other topics have worked…

Locally built builder study worked fine. I’ve synced ok with Pavlovia. But it loads a blank webpage with two errors:

Failed to load resource: the server responded with a status of 404 () psychojs-2020.css:1
Uncaught SyntaxError: Unexpected token ‘.’ Motion_ImageRating.js:800

I’ve looked at line 800 in the js file and it’s in the middle of psychoJS generated code, but close to a code component I’ve used in previous online studies that I know works fine.
I’ve tried swapping back to version 3.1.5 because I know that code component works in that version. When I do that I get stuck on the ‘initialising experiment’ page. With the same errors.

I’m wondering if it’s really a problem with the JS code or a server issue?

Many thanks!

Hi @KDaughters, the error is the code highlighted:

if (consent_1_resp.clicked_name.includes("cross_1")){
        return.psychoJS.quit('You did not consent. Goodbye.', false)

The error with this code is the . that appears between return and psychoJS. To fix, use:

if (consent_1_resp.clicked_name.includes("cross_1")){
        return psychoJS.quit('You did not consent. Goodbye.', false)

Great, thanks @dvbridges that’s fixed the syntax error.

I’ve now got a bunch of new ‘Failed to load resource error’ (e.g., /KDaughters/motion…/lib/core-2020.js:1) All to do with the ‘/lib/’.

Is that an error with using the 2020 version?