psychopy.org | Reference | Downloads | Github

Type Error: Cannot read property '_psychoJS' of undefined

URL of experiment: Pavlovia
URL to GitLab: Sign in · GitLab

Description of the problem:

I’ve looked through other threads, but I have not been able to find a solution. The problem I’m encountering is this:
Screen Shot 2020-04-10 at 7.41.05 PM

I’ve created the experiment in the Builder, and have added some code within the Builder. Everything syncs from Builder just fine, but when I try to run the experiment from my Pavlovia dashboard, I get the ‘_psychoJS’ undefined error. I can’t figure out the source of this issue, and it happens after I click ‘OK’ to run the the experiment in my browser.

Does anyone know why I am getting this undefined error?

I appreciate any help! I’m new to this and I feel like I am so close to making this experiment online ready. The experiment is currently set to “Pilot” by the way.

It’s a weird error message, but the source seems to be this, in the code component:

mySound = new sound.Sound("InC.wav");

This seems to be a problem with creating sound objects through code components in Pavlovia: Is it possible to play continuous sound in Builder?

I would say your best bet is probably to create the sound component itself in the builder, but control its playback through a code component, since you seem to only want to have the sound play on the first cycle of your trial loop.

On that note, that conditional is probably going to break as well, for unrelated reasons. You want to replace “fam_aud.thisN” with “trials.thisTrialN”. See here: "Take a break" works locally but not online

Thank you for the reply and thank you for the references!

I’m going to make these changes next chance I get. One of the reasons I gave up on the sound component is because I want the music to start where it left off in the previous trial. I’ll mess with the sound component again, though, to see if I can get it to do this in conjunction with the code component.

I’ll report back here if this does or does not work.

Thank you again for helping; your providing a great service here on discourse!

Hi again,

I took your advice to make a Sound Component in the Builder instead of creating a sound object through the Code Component. This was good advice and I came so close to getting the experiment running in my browser.

However, on the first routine I get this message:
Screen Shot 2020-04-13 at 8.34.54 PM

I hate to be a bother, but it seems like I keep running into sound issues.

  • Any fixes for this issue?
  • Or am I just incorrectly using .play() and .pause() to control the ‘sound_1’ component?

The current experiment does run without error in the Builder by the way. And I did also make the “trials.thisTrialN” adjustment.

Huh, I wonder if pause hasn’t been implemented in Pavlovia. You could try replacing it with stop and see if that works better, though it might also reset the audio file to the beginning.

I’m also not sure about this line:

  myStop = sound_1.pause();

I don’t think “pause” returns anything, so I’m not sure it can be used for variable assignment like that. If you’re trying to make an alias for calling sound_1.pause(), I would honestly have to look up how it works, but this is the kind of syntax I’d expect for a function that returned some value that was saved in the variable.

I got rid of the problematic myStop variable and I was able to see my first routine in the browser!

I think the sound issue is solved, but now I am faced with a Clock issue:

Screen Shot 2020-04-14 at 10.46.26 AM

Does this mean that core.MonotonicClock cannot be used on Pavlovia?

That’s correct. In Pavlovia, core.clock isn’t really used at all, everything is done through util.Clock. However, from what I can tell, util.Clock is a monotonic clock by default.