I create a brand new experiment, click on the ‘Compile to JS script’ button, Send experiment to Runner, and click ‘Run PsychoJS task in local debug mode’.
The browser then displays: “initialising the experiment…” and the developer console lists errors such as the following:
Loading module from “http://localhost:12002/lib/core-2021.1.1.js” was blocked because of a disallowed MIME type (“text/html”).
Loading failed for the module with source “http://localhost:12002/lib/core-2021.1.1.js”.
The Runner created a new lib directory for the experiment, but the filenames in it don’t match the ones in the error messages (eg, core-2021.1.js vs core-2021.1.1.js), and all files in this directory contain this:
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
This appears to be due to a bug in PsychoPy v2021.1, that can be fixed by editing the following PsychoPy code file: [python-package-directory]/psychopy/app/runner/runner.py:
@@ -703,7 +703,7 @@
Useful for debugging, amending scripts.
"""
libPath = str(self.currentFile.parent / self.outputPath / 'lib')
- ver = '.'.join(self.app.version.split('.')[:2])
+ ver = '.'.join(self.app.version.split('.')[:3])
psychoJSLibs = ['core', 'data', 'util', 'visual', 'sound']
os.path.exists(libPath) or os.makedirs(libPath)
After making the patch, restarting PsychoPy, and removing any existing lib directory, local debug mode now works fine.