| Reference | Downloads | Github

Cannot read property 'create' of undefined

URL of experiment: Pavlovia

Description of the problem: My experiment was running perfectly on PsychoPy, but when I transferred it to Pavlovia it got stuck on the ‘initializing experiment’ screen. Using the Developer Tool, I looked at the line of code that gave the error “Cannot read property ‘create’ of undefined”

The underlined line is line 1360:
isNative = usableCustomElements && info.create.length === 1;

I do not know JavaScript at all, so I wasn’t able to read and follow the code to fix this. I’m open to any and all suggestions.

Do you have a variable called info?

Or info.create?

Try changing the name?

I didn’t create a variable named info in python, but I think it was generated automatically when I translated to JavaScript.

I am not sure what it is or does, but this is how it was created if it helps:

var htmlClass = (function (info) {
// (C) Andrea Giammarchi - @WebReflection - MIT Style
catchClass = /^[A-Z]+[a-z]/,
filterBy = function (re) {
var arr = [], tag;
for (tag in register) {
if (re.test(tag)) arr.push(tag);
return arr;

I don’t recognise any of that. What is it supposed to do? Can you test your code without it?

This is the first place it is initialized, but info is used quite a few times throughout the code. So I don’t think I can get rid of it.

The line of code the Developer Tool led me to is not on my main .js file. It is in something called document-register-element-node. I’m not sure I’m looking at the right place to fix my code. Any suggestions?

Were there any error messages that gave a line number of your script?

Unfortunately not. I edited my experiment through the Builder a little bit, and now it does not get stuck at “initializing screen” but it keeps giving me other errors as I go through. I’m wondering if any of those are related to this problem.

If you set it to running, add a few credits and disable saving partial data then I could take a look at the error messages.

I disabled saving partial data, but unfortunately I can only set it to piloting as my institution has not allowed me any credits yet. Currently, I believe the problem is when I am using “data.importConditions” to read from my files. I get the error data not defined. I have seen some solutions where they add some JS code to the beginning of the experiment, but it doesn’t work for me as I use this in 3 different places, and I generate the name of the file randomly in that routine.

To go into more detail, this is the JS code I am referring to:

myData = new TrialHandler({

psychoJS: psychoJS,

nReps: 1, method: TrialHandler.Method.SEQUENTIAL,

extraInfo: expInfo, originPath: undefined,

trialList: 'conditions.xlsx',

seed: undefined, name: 'myData'});

However, I have various trialLists and the names of the files are not ‘conditions.xlsx’

primeCond = randint(0, 2)
fileName = str(primeCond) + 'list.xlsx'

This is what I am referring to when I say I generate the names of files. I have multiple similar routines.

I have started a new thread for this issue: