Based on the description provided, it seems like the issue is that when running npm run dev with Vite, the default Laravel Vite page is being displayed instead of the expected Laravel project.
To resolve this issue, you need to make sure that you have properly configured Vite to work with your Laravel project.
Here are the steps you can follow:
- Make sure you have installed Vite globally by running the following command:
npm install -g create-vite
- Create a new Vite project in your Laravel project's root directory by running the following command:
create-vite
This will create a new Vite project in a separate directory.
- Once the Vite project is created, navigate to the Vite project directory by running the following command:
cd vite-project
- Install the required dependencies for the Vite project by running the following command:
npm install
- Build the Vite project by running the following command:
npm run build
This will generate the necessary files for the Vite project.
-
Copy the generated files from the Vite project's
distdirectory to your Laravel project'spublicdirectory. -
In your Laravel project's
resources/views/welcome.blade.phpfile, update the<script>tag to point to the Vite-generated JavaScript file. For example:
<script src="{{ asset('js/app.js') }}"></script>
- Finally, run the Laravel development server by running the following command:
php artisan serve
Now, when you access the local URL, it should display your Laravel project instead of the default Laravel Vite page.
Please note that these steps assume you have already set up Laravel and have a basic understanding of Laravel and Vite. If you are still facing issues, it would be helpful to provide more details about your project setup and any error messages you are encountering.

