Uncaught SyntaxError: Invalid or unexpected token - Stuck at initialising

URL of experiment: https://run.pavlovia.org/SueLynnNotts/pc1/html

Description of the problem:
This experiment is exactly like one of my previous pavlovia experiment (which still works perfectly). The reason why I made a new one is because I needed to change some details and because I am still running participants on the previous one, I didn’t want to compromise anything.

This current experiment works fine locally and I managed to sync it to pavlovia. However, once I tried running it, it is stuck at ‘initialising the experiment’ stage. I have read through the posts related to this issue and tried to troubleshoot accordingly but still no luck.

When I opened the developer tools in my web browser (Chrome), the only error I got was ‘Uncaught SyntaxError: Invalid or unexpected token’ but I run my experiments using an institutional license.

Also, at the pavlovia dashboard, I noticed that is says ‘INACTIVE’ even though I have already clicked on ‘RUNNING’

I’m not sure what else I could do. Any help would be appreciated!

I just finished dealing with a similar issue (and read a TON of forums, etc. to figure it out). The token is a key of sorts in the code that doesn’t belong. Did it not give you the specific unexpected token? I had two versions of the same error: “unexpected token ‘*’” and “unexpected token ‘,’”. I’ve also seen other tokens in other forums. You should check the error message in developer tools to see which line in the JS code is going wrong. Then you can look at that line in the code to see if it looks off and you’ll have a clue about when this pops up during your experiment.


Unfortunately, it doesn’t specify which token they are referring to :confused:

Also, I don’t use audio in my experiments so I’m not sure why that warning was there

I think that audio thing just kinda happens. It happens to me too, even in the experiment runner in builder. I don’t think it means anything.

For the error, go to line 2274 in your JS code to see what’s happening.

Thanks for the advice! It turns out I had a random # and I didn’t close my if statements for my JS codes but it has been sorted now :smiley:

1 Like