Install Vue.js in Laravel step by step
In this lesson, we will learn how to install Vue.js in Laravel framework. So, let’s get started and follow the steps below to get results.
1: Install Laravel
First of all, you need to install a new Laravel project (if it doesn’t exist) on your system to install Vue.js, enter the command below to install Laravel
composer create-project –prefer-dist laravel/laravel blog
2: Install Laravel/user interface
After that, we need to install the Laravel user interface in this project, so copy the code below into your project folder and run it with the composer command.
composer require laravel/ui
3: Install the view
After installing the above package, we can install Vue with our application.
We can install Vuejs in two different ways, the first is a simple vue installation and the second is a vue installation with authorization. So, let’s check both ways.
Simple setup.
php artisan ui vue
Install vue with authorization to log into laravel by default and register
php artisan ui vue –auth
So, we have installed Vue.
4: Install the node
You also need npm to run vuejs, so we need to install NPM to get the correct output of vuejs. First of all, download the npm at the link below.
https://www.npmjs.com/get-npm
After installing NPM, we need to check if it is installed or not. So, copy the code below and run it in your terminal to check.
node -v
5: Install NPM
At this point we need to install npm in our project, so copy the code and paste it into your terminal.
npm install
6: Run NPM
Now run npm on your system with the code below.
npm run dev
That’s it, now you can run vue js in your laravel application.