Is your PHP and laravel versions the required versions, just something to double check.
Edit:
Totally not related but you may find this of interest: https://laracasts.com/discuss/channels/general-discussion/stackoverflow-technology-survey
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Can anyone help me please with my Inertia install? In fact I have two Inertia problems. Let's focus on the first one above, as it might be inked to the second one: Undefined variable $page.
I am installing Inertia.js and Vue 3 into a current L10 application. Up until now that app has been only been using Laravel/blade with Javascript. I want to use Vue and Inertia to build new pages going forward where I previously had been using JS. I have done this with a different application, which works well.
I use mix NOT vite. Vite has a conflict with the Bootstrap framework. I'm using PHP 8.1. I have followed Jeffrey's install tutorial to the letter, however, I did use the current Inertia install statements rather than the older one's in @jeffreyway tutorial. HIs tut is a bit out of date. When I run npx mix everything compiles nicely but I get this warning:
WARNING in ./resources/js/bootstrap.js 17:16-27
Critical dependency: Accessing import.meta directly is unsupported (only property access is supported)
Here is the resources/js/bootstrap.js the warning refers to. It was taken straight off the inertia website, however it differs from Jeffrey's tut.:
import { createApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/vue3'
createInertiaApp({
resolve: name => {
const pages = import.meta.glob('./Pages/**/*.vue', { eager: true })
return pages[`./Pages/${name}.vue`]
},
setup({ el, App, props, plugin }) {
createApp({ render: () => h(App, props) })
.use(plugin)
.mount(el)
},
})
Despite everything compiling properly, when I attempt to login to my application I now get this error:
Undefined variable $page
And the error exception page highlights the Inertia recommended directive : @inertiaHead. **NOTE: However, if I REMOVE @inertiaHead and @inertia I can login to my laravel page as normal. **
This does not make sense to me. I updated the ServiceProvider to.
public function boot()
{
Inertia::setRootView('layouts.app'); // <<<<< ADDED
}
And my App finds the layouts.app. This was recommended here: https://laracasts.com/discuss/channels/laravel/getting-inertia-to-use-a-different-app-file
I found a solution to the problem. The code given in the Inertia tutorial for app.js is designed for Vite. I believe this is not made sufficiently clear in the documents. The code you need for app.js for a MIX implementation is below. I hope this helps someone else.
import { createApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/vue3'
const app = document.getElementById('app')
if (app) {
createInertiaApp({
resolve: name => require(`./Pages/${name}`),
setup({el, App, props, plugin}) {
createApp({render: () => h(App, props)})
.use(plugin)
.mount(el)
},
})
}
Please or to participate in this conversation.