Vite error in Laravel

Website URL

(please specify the URL of the site on which you are experiencing the problem)

Error Message

Class “App\Providers\Vite” not found

Other Information

Hello I saw a Laravel site builder and tried it. I already have a Laravel Inertia Vue Vite project and I’m curious if it can run on infinityfree

Does Laravel version available here support Vite for Vue?

Laravel throws an error like the one below

Error screenshot - https://postimg.cc/zVFRSxzB

A “Class not found” error sounds like either code is missing from your website, or there is an error in your code.

Looking at the screenshot of the code itself, I suspect you’re trying to apply the code from this example:

Do you have the line use Illuminate\Support\Facades\Vite; at the top of your file too? If not, then that could explain the class not found error you see.

4 Likes

Yes, I have the use Illuminate\Support\Facades\Vite; on top it’s there by default on AppServiceProvider.php file

I had a look and you’re wrong on both counts: it’s not there by default, and it’s not in your code.

The error message doesn’t make sense if it was. If that use statement was there, then PHP wouldn’t try to guess that the Vite class would be App\Providers\Vite, the use statement would tell PHP that it’s actually Illuminate\Support\Facades\Vite.

I try to avoid having to look into people’s code, but the error message should be impossible if what you were saying was true.

So please add the missing use statement to your code.

8 Likes

I used the laravel breeze starter kit so i thought all was setup since its creation. I admit this funny mistake. Thank you for providing support.

Website URL

stoicicelab.rf.gd/lza

Error Message

Internal Server Error
Class “Inertia\Inertia” not found

Other Information

To prevent another funny mistake, I did my homework, I made sure the use Inertia/Inertia is there. search the internet for some related issues, it seems that this can be solved by running some composer or php artisan commands? Or is there another way to solve this error?

https://postimg.cc/KkZSX8XL

My project used Laravel Breeze starter kit with Inertia / Vue and planning to make it work since the infinityfree has Laravel installation available

If you do need to run it, then please understand that our hosting doesn’t support shell commands, and you’ll have to run these commands first on your own device, then upload the resulting files.

It actually doesn’t matter whether you already have laravel “installed” on your hosting account or not.

Laravel is not a CMS, it’s a framework that you develop things on it. It’s not like you can “install” it and “add plugins” to it, not at least when you don’t write code that turns it into a CMS that can do this.

5 Likes

Thanks for the reply. First of all I’m not expecting that free hosting is have it all - I’m fully aware of this.
I used to have a plain php website here in infinityfree hosted for years, so I know already that uploading files with FTP is the first thing I would normally do.

So i have a new laravel/inertia/vue project, the first thing I did was is uploading this whole thing zip archived. Of course i did run composer and npm run build commands for this before archiving.

But I also noticed that after many tries, any files that exceeded 16MB above the FTP connection shuts down. I even did archived each the directories and upload it one by one coz maybe the FTP server hates it, I respect that and also I’m not complaining coz free hosting has limitations - I’m fully aware of that.
I actually gave up at this point until I saw that Laravel can be installed.

So I just started from there and tried my best to make it identical to my local project as best as I can.

So there it is, I got my answer. I don’t wanna sound asking too much. I just needed an answer thank you.

You can run Laravel on our hosting, but that doesn’t mean that every Laravel site can be uploaded with no issues. After all, Laravel is a framework, and you can use it to make wildly different applications.

Softaculous includes Laravel, but please keep in mind that:

  • The Softaculous catalog is managed by Softaculous, not us. We haven’t vetted and tested everything that Softaculous ships and verified that it works on our hosting. There may be some scripts in Softaculous that don’t (fully) work on our hosting, or even violate our terms of service.
  • While Softaculous ships Laravel and a few other frameworks, I cannot think of any reason why you’d ever want to install a framework that way. A framework is just a framework, you’ll still need to build your application with it, and you’ll want to have everything on your own computer for that. Especially since you’ll need to run Composer/Artisan/NPM commands.

You should also knows that there is a 10 MB global file size limit on our hosting, and a 1 MB limit for PHP. Composer autoload files are known to get quite big if you use the optimized autoloader.


As for the Inertia issue, the import seems OK. But is the required Composer package also installed? I don’t know what Breeze actually pre-installs for you, but please make sure the required package is installed. Also make sure that these files are actually uploaded to your hosting account.

https://inertiajs.com/server-side-setup

If you installed Laravel from Softaculous, note that it won’t have all the Breeze goodies installed by default, it’s just plain Laravel which means Inertia is not installed.

Yes, that’s not going to work. You can’t upload the zip file and extract it on the server, your best bet is to upload the extracted directory with FileZilla or another desktop FTP client. Both because of the file size limit and because there isn’t really a way to extract the zip file on the server.

6 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.