Reference errors when running experiment online (works fine locally)

URL of experiment:

Description of the problem:
Running the experiment works fine through psychopy builder, but when trying to run online I get one of two error messages. One reference error is “np not defined”, which I think is due to my use of the numpy “arange” function, but I can’t find a way of importing the numpy module to work in javascript? Secondly, the error “win is not defined” (see screenshot) which I have no idea what might be causing it. I’d really appreciate any help or advice, thank you.

@harry_bsms, this may be because you are calling the win.flip method in your experiment. If you are using Builder, this is not advised as Builder handles the screen refresh for you. If you want something to occur on screen refresh, you can use the win.callOnFlip command (see docs).

This error is specifically because win is not defined in online JS tasks in the same way as local Python tasks. However, you can use the call on flip method online using psychoJS.window.callOnFlip()

Thanks!

H