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

caliwa-73606838's avatar

LIVEWIRE 3.5.0: SyntaxError: Unexpected token 'H', "Hello, World!" is not valid JSON

Hello there, this is my first thread, 'cause i got a big issue with livewire 3.5.0 on my xampp server with laravel 8.2.0 Uncaught (in promise) SyntaxError: Unexpected token 'H', "Hello, World!" is not valid JSON at JSON.parse () at ac (app-CnLVuBoE.js:6:96339) at async ec.send (app-CnLVuBoE.js:6:92821) I dont know how to resolve it, I spent a lot of days searching an approaching, reinstalling livewire, create a new one project to pass the existing code and nothing new happens, anyone has an idea? thx :)

0 likes
8 replies
Kortez12's avatar

Hello, in Livewire v3 documentation it is written, that you need a minimum Laravel v10 version. You said you are using v8.2.0, so the problem may be there. Also, can you show your app.js file?

caliwa-73606838's avatar

@Kortez12 I'm using Laravel Framework 10.48.12 with php 8.2.0 and livewire 3.5.0, the compatibility between Laravel and PHP is really good. I've upgraded and downgraded Livewire versions, and it's the same. I even reverted to the initial version when Livewire started, and the same error persisted. I created a project from scratch in laravel 10.48.12 and transferred the contents of the Livewire components, but it's still the same. My app.js is this (manually with @livewireScriptConfig ):

import { Livewire, Alpine } from '../../vendor/livewire/livewire/dist/livewire.esm'; import Clipboard from '@ryangjchandler/alpine-clipboard'

Alpine.plugin(Clipboard)

Livewire.start()

import './bootstrap'; import 'flowbite/dist/datepicker.js'; import 'flatpickr'; import jQuery from 'jquery'; import select2 from "select2"; select2(); window.$ = jQuery;

import './gen-cot'; import { startInterval, toggleVisibility, handleChange, ObserverSubmodal, disconnectSubmodalObserver } from './gen-cot'; window.startInterval = startInterval; window.toggleVisibility = toggleVisibility; window.handleChange = handleChange; window.ObserverSubmodal = ObserverSubmodal; window.disconnectSubmodalObserver = disconnectSubmodalObserver;

import './sidebar'; import './dark-mode'; import './charts';

Snapey's avatar

show your code where you have written "Hello world"

caliwa-73606838's avatar

@Snapey I don't have any hello world, the error redirects me to build/assets, the line where the 'hello world' is generated refers to alpinejs and I think it's something Livewire defaults to. How can I put a image here?

caliwa-73606838's avatar

@Snapey I saw all the files and could not find "Hello, world!", I unminified the asset and get the scope of code where the exception is (this exception happens when I try to click any wire:click, recently I deleted lazy loading from the livewire component and the frontend loads but unfortunately it did not move a step forward.): $i("request.profile", H), G = ql(); $i("request", { url: G, options: H, payload: H.body, respond: q => O.push(q), succeed: q => L.push(q), fail: q => U.push(q) }); let ae; try { ae = await fetch(G, H) } catch { X({ content: "{}", failed: !0 }), _(), E({ status: 503, content: null, preventDefault: () => {} }); return } let J = { status: ae.status, response: ae }; C(J), ae = J.response; let Z = await ae.text(); if (!ae.ok) { X({ content: "{}", failed: !0 }); let q = !1; return _(), E({ status: ae.status, content: Z, preventDefault: () => q = !0 }), q ? void 0 : (ae.status === 419 && cc(), uc(Z)) } if (ae.redirected && (window.location.href = ae.url), Ko(Z)) { let q; [q, Z] = Ul(Z), el(q), X({ content: "{}", failed: !0 }) } else X({ content: Z, failed: !1 }); let { components: ue, assets: ne } = JSON.parse(Z); await Jo("payload.intercept", { components: ue, assets: ne }), await s(ue), P({ status: ae.status, json: JSON.parse(Z) }) }

Please or to participate in this conversation.