Artisan command "make:auth" is not defined in Laravel 6
Asked Answered
A

9

27

I have a problem when creating login/auth in Laravel 6. I typed "make: auth" in the terminal and I get an error "Command" make: auth "appears not defined." Is there a solution for this?

Aflame answered 3/9, 2019 at 14:56 Comment(3)
Did you try php artisan make:auth?Secundas
It looks like they decided to have all the auth included by default nowCaracas
@HarunYilmaz Yes I tried thatAflame
C
41

Looks like L6 moves the Auth scaffolding into a separate package.

https://laravel.com/docs/6.0/authentication

Want to get started fast? Install the laravel/ui Composer package and run php artisan ui vue --auth in a fresh Laravel application.

Curtain answered 3/9, 2019 at 15:2 Comment(3)
@Vipertecpro Is your app Laravel 6?Curtain
Yes i freshly installedPastoralize
@Pastoralize And you did composer require laravel/ui to install UI?Curtain
P
28

Laravel 9.x Starter Kits

Laravel Breeze

composer require laravel/breeze --dev
php artisan breeze:install

Breeze & React / Vue

php artisan breeze:install vue
 
Or...
 
php artisan breeze:install react
 
php artisan migrate
npm install
npm run dev

Laravel 8.x

This command will create a new application with all of the authentication scaffolding compiled and installed:

laravel new kitetail --jet

Laravel's laravel/jetstream package provides a quick way to scaffold all of the routes and views you need for authentication using a few simple commands:

composer require laravel/jetstream

// Install Jetstream with the Livewire stack...
php artisan jetstream:install livewire

// Install Jetstream with the Inertia stack...
php artisan jetstream:install inertia

Github : laravel /jetstream

Official Documentation : Laravel Jetstream Documentation

Laravel 7.x

composer require laravel/ui --dev

php artisan ui vue --auth

Laravel 6.x

Laravel's laravel/ui package provides a quick way to scaffold all of the routes and views you need for authentication using a few simple commands:

composer require laravel/ui "^1.0" --dev

php artisan ui vue --auth

After above commands, you'll get following output :-

Vue scaffolding installed successfully.
Please run "npm install && npm run dev" to compile your fresh scaffolding.
Authentication scaffolding generated successfully.

Now after running this command run this command, for Vue scaffolding

npm install && npm run dev

If you're get following error message

npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR! 
npm ERR! To permanently fix this problem, please run:
npm ERR!   sudo chown -R 1000:1000 "/home/shiv/.npm"
npm ERR! code EACCES
npm ERR! syscall open

Then give permission user to access .npm files from system

sudo chown -R 1000:1000 "/home/system_user_name/.npm"

As i now understood clearly,running "sudo command is dangerous for npm configurations"

Please look it this threat for more clear understanding :- How to fix npm throwing error without sudo

Pastoralize answered 3/9, 2019 at 20:54 Comment(5)
Is there a reason you're just basically reposting my answer?Curtain
Umm No sir really not, i'm simply following laravel instructions I'm facing issues like, Unhandled rejection Error: EACCES: permission denied, so i'm updating my answer for further more information.Pastoralize
I don't understand why I'm getting downvote on this, please explain or tell me to remove my answer ?Pastoralize
It's a) a duplicate and b) sudo npm install can break things.Curtain
Thank you sir for pushing me to understand such a blunder mistake, Thank you so much i updated my answer. Please reviewPastoralize
A
12

One major change introduced in Laravel 6.0 is the removal of php artisan make:auth Command

Basically, make:auth command was used to create the authentication scaffolding. The concept has not been removed, but the way of implementation has been changed

Update for Laravel 6: The New Way

Authentication support is now added with the help of a package now (More details)

The command to implement Auth is as follows:

composer require laravel/ui
php artisan ui vue --auth

This command will install a layout view, registration and login views, as well as routes for all authentication end-points. A HomeController will also be generated to handle post-login requests to your application's dashboard.


NOTE: If your Login and Register page only shows plain HTML. And CSS is not loading properly then run this two command:

npm install
npm run dev
Alligator answered 19/9, 2019 at 12:10 Comment(0)
F
11

In Laravel 6.0 make:auth no longer exists. Read more here

1 - First do this:

composer require laravel/ui

Note: Laravel UI Composer package is a new first-party package that extracts the UI portion of a Laravel project ( frontend scaffolding typically provided with previous releases of Laravel ) into a separate laravel/ui package. The separate package enables the Laravel team to update, develop and version UI scaffolding package separately from the primary framework and the main Laravel codebase.

2 - Then do this:

php artisan ui:auth

instead of

php artisan make:auth  ( which works for Laravel 5.8 and older versions )

It will generate the auth routes, a HomeController, auth views, and a app.blade.php layout file.

You can also generate the views only with:

php artisan ui:auth --views

The console command will prompt you to confirm overwriting auth files if you've already run the command before.

More Options here

// Generate basic scaffolding...
php artisan ui vue
php artisan ui react

and also:

// Generate login / registration scaffolding...
php artisan ui vue --auth
php artisan ui react --auth
Fortin answered 9/9, 2019 at 12:7 Comment(1)
hey @panjeh, what is the difference between php artisan ui:auth and php artisan ui vue?Fransen
C
2

if you are using laravel 6, then try this command because with this command 'composer require laravel/ui' you will get only for Laravel 7.0 version and up,

        composer require laravel/ui "^1.0" --dev

After Install the laravel/ui using via Composer run below command for auth scaffolding package,If Using vue then use below one,

        php artisan ui vue --auth 

If using bootstrap then use below one,

        php artisan ui bootstrap --auth

in a fresh Laravel application or with use of the documentation.

Cletis answered 30/3, 2020 at 5:16 Comment(0)
F
2
composer require laravel/ui
php artisan ui bootstrap --auth

npm install
npm run dev
Fineable answered 15/4, 2020 at 23:22 Comment(0)
B
0

you can copy the composer.json file and the app/Exceptions/Handler.php files from the official laravel 7 repo. link to repo: https://github.com/laravel/laravel

Then run

composer update

composer  require laravel/ui "^2.0"

php artisan ui vue --auth
Bespectacled answered 12/5, 2020 at 5:26 Comment(0)
V
0
  • composer require laravel/ui
  • php artisan ui bootstrap --auth

  • npm install --global cross-env

  • npm install --no-bin-links
  • npm run dev
Verwoerd answered 13/6, 2020 at 22:17 Comment(1)
explain your solution which will also make it more acceptableJann
T
-1

Laravel verion 6.0

  1. composer require laravel/ui
  2. php artisan ui vue --auth

these commands will help

Tubman answered 7/9, 2019 at 5:1 Comment(2)
This is now the third answer duplicating my already accepted one. 🤷‍♂️Curtain
Please do not duplicate existing answers, unless you want to share new insights. If this is the case here, please add some more explanation such that others can learn from your answerNullification

© 2022 - 2024 — McMap. All rights reserved.