In this article, we will learn how to install Vue in Laravel. In older versions of Laravel, Vue was set up automatically with every new installation. However, in newer versions, you have to set it up yourself. Let’s see it step by step.
Install Vue In Laravel
laravel/ui is a separate package that provides the UI scaffoldings for bootstrap, vue, and react. Alongside the auth scaffold for login and registration.
Follow these steps to get Vue set up in your Laravel app.
- The Bootstrap and Vue scaffolding provided by Laravel is located in the
laravel/uiComposer package, which may be installed using Composer:
composer require laravel/ui
- Once the
laravel/uipackage has been installed, you may install the frontend scaffolding using the ui Artisan command:
php artisan ui vue
If you also need to add the auth scaffolding, add the
--auth switch to the command:
php artisan ui vue --auth
- Finally, you’ll need to install the newly added dependencies and compile them by running the following command
npm install && npm run dev
Note: if you’re running this for the first time, Mix might need to install additional dependencies which it’ll pull in automatically. If you see an error message, just run npm run dev again.
That’s it from our end. We hope this article helped you to learn how to install Vue in Laravel.
Additionally, read our guide:
- Laravel: Blade Switch Case Statement Example
- Laravel: Switch Case Statement In Controller Example
- How To Use CASE Statement In Laravel
- Laravel: Change Column Name In Migration
- How To Use Where Date Between In Laravel
- How To Add Laravel Next Prev Pagination
- Laravel Remove Column From Table In Migration
- Laravel: Get Month Name From Date
- Laravel: Increase Quantity If Product Already Exists In Cart
- How To Update Pivot Table In Laravel
- Angular: Declare Global Variable With Example
- How To Handle Failed Jobs In Laravel
- How To Remove WooCommerce Data After Uninstall
- How To Get Latest Records In Laravel
- How To Break Nested Loops In PHP Or Laravel
- How To Pass Laravel URL Parameter
- Laravel Run Specific Migration
- WordPress: Create Reset Password Link
Please let us know in the comments if everything worked as expected, your issues, or any questions. If you think this article saved your time & money, please do comment, share, like & subscribe. Thank you for reading this post 🙂 Keep Smiling! Happy Coding!