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

Renatas's avatar

Strange Vite error: Too few arguments to function Illuminate\Foundation\Vite::__invoke()

Hello, I started getting this error today, even though I changed pretty much nothing from yesterday, when it was working just fine. The full error is:

Too few arguments to function Illuminate\Foundation\Vite::__invoke(), 0 passed in <path>/storage/framework/views/e17f05ed3e1c5b918d987a69cc70f42fcac65fdf.php on line 8 and at least 1 expected

Pretty much the only change I did from yesterday was uninstalling Ziggy with composer and then I noticed that it broke. I undid all changes and it still doesn't work. I also noticed just this morning that Laravel moved to Vite and I got confused if I need to do any configurations with the laravel-vite plugin since I've already been using it and I've had Laravel 9.19 for a few days now with everything working...

When googling the error, I got some results regarding incorrect route parameters, but I don't think there's any room for error on my part here - the project is fresh and I only have the following as a route. Also maybe worth noting that at the moment the editor marks the function inertia as undefined, even though it didn't yesterday...

Route::get('/', function () { return inertia('AppHome'); });

What is happening !? My stack is Laravel 9.19, Inertia, Vite, Vue

0 likes
13 replies
Tray2's avatar

It expects you to pass at least one parameter, but if you read the error message you see that it is a compiled view that complains, so try clearing the laravel cache.

Sinnbeck's avatar

@Renatas yeah thats good as well. Then I assume you are using the helper somewhere

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Show how your @vite() looks. It takes an array of resources to show

2 likes
Renatas's avatar

@Sinnbeck I don't actually have @vite(), this is how my app.blade.php looks:

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <script type="module" src="http://localhost:3000/@vite/client"></script>
    <script type="module" src="http://localhost:3000/src/main.ts"></script>

    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">

    @routes
</head>

<body>
    @inertia
</body>

</html>

It's how I've had it set up for all projects before after reading Laravel and Inertia docs

Sinnbeck's avatar

@Renatas you must be referencing it somewhere? If not, you aren't using vite. Check the stack trace

Renatas's avatar

@Sinnbeck So I went through the Laravel docs and changed it to this

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    @vite('src/main.ts')

    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
    @routes
</head>

<body>
    @inertia
</body>

</html>

and now it seems to be working. I've just never been more confused than I am now. I haven't checked Laravel updates in a while so I didn't notice the Vite update, so I just used it without the @vite helper, as it hasn't existed before to my knowledge. This morning I started working and suddenly it broke... I guess a lesson learnt is to keep up to date :-) thanks for the help!

Sinnbeck's avatar

@Renatas sorry I'm a bit confused as well. You used vite before but without the vite plugin or the official vite helper? Did you implement it yourself by any chance? :)

But awesome that it works

1 like
Renatas's avatar

@Sinnbeck Not really, it's been a while now so I don't quite remember how I got it set up, but every tutorial and project I checked had something like this instead of the @vite() helper, so I want to assume it didn't even exist before these recent Laravel updates...

 <script type="module" src="http://localhost:3000/@vite/client"></script>
 <script type="module" src="http://localhost:3000/resources/js/app.js"></script>

Today has been quite a day so far haha

jcs224's avatar

For those who've already been using Vite with a manual implementation and don't want to change too much code, just add an additional @ in front of the @vite in the script url:

<script type="module" src="http://localhost:3000/@@vite/client"></script>

The issue is, now that there is a @vite Blade tag from Laravel, it conflicts with Vite's @vite already present in the URL. Adding an additional @ escapes @vite from being a blade tag.

5 likes

Please or to participate in this conversation.