Uncaught TypeError: jsPsych.plugins is undefined

51 views
Skip to first unread message

Nachshon Korem

unread,
Jan 15, 2021, 8:43:12 PM1/15/21
to jsPsych
Hi,

I am trying to move a script I wrote in jsPsych to psiturk.
The script worked when I uploaded it to a private server.

I took the script from the jsPsych_psiturk example and replaced the exp code with mine. I also added all the necessary  jsPsych *.js file to the static library.

I am now getting
an error

Uncaught TypeError: jsPsych.plugins is undefined
Uncaught TypeError: jsPsych.pluginAPI.registerPreload is not a function

and the same for all other libraries.

The code I am using to load the libraries is

<head>
<title>too be filled later</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">

<script src="/static/lib/jquery-min.js" type="text/javascript"></script>
<script src="/static/lib/underscore-min.js" type="text/javascript"></script>
<script src="/static/lib/backbone-min.js" type="text/javascript"></script>
<script src="/static/js/jspsych/jspsych.js" type="text/javascript"></script>
<script src="/static/js/jspsych/plugins/jspsych-html-keyboard-response.js" type="text/javascript"></script>
<script src="/static/js/jspsych/plugins/jspsych-image-keyboard-response.js" type="text/javascript"></script>
<script src="/static/js/jspsych/plugins/jspsych-survey-html-form.js" type="text/javascript"></script>
<script src="/static/js/jspsych/plugins/jspsych-survey-multi-choice.js" type="text/javascript"></script>
<script src="/static/js/jspsych/plugins/jspsych-survey-likert.js" type="text/javascript"></script>

<script type="text/javascript">
// These fields provided by the psiTurk Server
var uniqueId = "{{ uniqueId }}"; // a unique string identifying the worker/task
var adServerLoc = "{{ adServerLoc }}"; // the location of your ad (so you can send user back at end of experiment)
var mode = "{{ mode }}"; // is this running live, sandbox, or in debug mode?
</script>

The code I ided that worked was
<head>
<title>Title</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<script src="jspsych-6.1.0/jspsych.js"></script>
<script src="jspsych-6.1.0/plugins/jspsych-html-keyboard-response.js"></script>
<script src="jspsych-6.1.0/plugins/jspsych-image-keyboard-response.js"></script>
<script src="jspsych-6.1.0/plugins/jspsych-survey-html-form.js"></script>
<script src="jspsych-6.1.0/plugins/jspsych-survey-multi-choice.js"></script>
<script src="jspsych-6.1.0/plugins/jspsych-survey-likert.js"></script>
<link rel="stylesheet" href="jspsych-6.1.0/css/jspsych.css">
<style>
.stimulus { font-size: 36px; }
.questions { font-size: 32px; }
img { width: 80%; height: 80%; }
html { font-size: 24px; }
</style>
</head>

Thanks so much for the help!
Nachshon Korem
Reply all
Reply to author
Forward
0 new messages