Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hellomars's avatar

Uncaught ReferenceError: Spark is not defined

Hi Spark users,

I've been developing my Laravel app for some time now and decided to merge everything into Spark. I quickly realized my limited PHP/JS background was not really compatible with Spark so I tried to touch the Spark code as little as possible in order to keep things working and just use the goodies of Spark (stripe integration, user notifications etc etc.

Anyway, I think I broke it. I can open my page but can't get the drop down user menu. Chrome informs me about the following error:

Uncaught ReferenceError: Spark is not defined at Object.module.exports.el (app.js:24333) at webpack_require (app.js:20) at Object. (app.js:18567) at webpack_require (app.js:20) at Object. (app.js:51833) at webpack_require (app.js:20) at app.js:66 at app.js:69

I am using a Ubuntu installation that I build using vagrant, everything seemed to work fine. Since I wanted to update to Laravel 5.5 anyway, I decided to checkout a new Spark project and integrate all my code. After some hurdles I got it to work, but again, the same error. It's probably something very trivial, so I apologize in advance ....

Hope someone recognizes the problem...

0 likes
3 replies
hellomars's avatar

For sake of completedness, if I checkout a vanilla spark test app I can register and everything works perfect.

[edit] And after copying the relevant files, modifying composer.json (and running composer update etc). I get the same error again.

Cronix's avatar
Cronix
Best Answer
Level 67

There's probably no way for someone to guess what you could have done to break it. Since you can get it to work until you start changing it (adding your code) I'd start with a fresh copy, verify it works, and then start tediously copying small parts of code, AND TEST IT each step of the way until you break it. Don't start copying everything. One small piece at a time until you find what actually is breaking it. Once you determine that, and if you can't figure out what's causing it on your own, I'm sure we can help, but we need to narrow it down quite a bit.

That said, I don't believe spark is 100% compatible with Laravel 5.5 yet. I'd use 5.4 until they have a 5.5 compatible release, which should be really soon.

1 like
hellomars's avatar

Thanks Cronix, you were absolutely right. I began copying all of the necessary files and found a duplicated code block containing references to js files that was not placed correctly. I'll also wait updating my Spark application until the final version will arrive.

Please or to participate in this conversation.