Converting custom JS back to PSYEXP and running locally/offline

According to Manual coding of PsychoJS studies — PsychoPy v2022.2.2 generating JS code is a one way street and cannot be converted back to the builder, but is there another way to run the experiment locally? In the coder I can load my JS code but the ‘Run Experiment’ button is greyed out.

Due to IT bureaucracy I’m not able to properly link between the builder/coder and Pavlovia and thus am at a bit of an impasse for running this experiment on a non-online computer. Any suggestions appreciated.

You can run the PsychoJS-Experiment locally with any kind of local web server.

I am not sure about your specific situation but:

  1. If you have a correct Builder PsyExp Experiment and you just not able to push to Pavlovia, try open the Runner (Play button with little list in it) and then press the Play Button with the little Bug in it). This opens a local web server.

  2. If you have build soe Custom Manual Coded PsychoJS Experiment, I commonly use Visual Studio Code with this extension Live Server - Visual Studio Marketplace to run my JavaScript experiments locally.

So normally you have the Builder PsyExp Experiment and generate PsychoJS code from it (normally an index.html and the .JS-Code of the Experiment).

In any case if you add the required lib-Files (specified in the index.html file) to a local folder /lib/. (the builder does this if you choose “Export to HTML” in the File menu.

But I would encourage you (if you havent done extensive custom JS-Coding in your project) to just rebuild a Python focused Builder experiment with automatic JS Code Conversion to run a Python based offline version of your experiment.

@Luke Thanks for your feedback back in July, I originally managed to get the code working fine online in the end but now the site is completely unresponsive to any new experiments I’m trying to make via gitlab (i.e. not appearing on the Pavlovia site) and I cannot find any support so I’m back to this.

Unfortunately I’ve had to modify the code pretty heavily to add functionality not directly supported by the Builder so I’ll need to run it on the local server for VS you mentioned. However I’m running into issues, I assume with adding the lib files, can I just download the js files it’s referring to and put them in the experiment directory in a sub /lib/ folder and then change the links in the html file?

If you’ve followed or know of any tutorials to this I’d really appreciate it. This is really not my coding area.

I write my experiments so they work online and offline whenever possible.

If your original is in JS code then you’d need to start again in Builder.

If your original is in Builder you should be able to customise it through code components.

I wrote this post a while ago and just came across the draft. Sorry if it’s no longer relevant