Command 'ui' is not defined in laravel 6.0
Asked Answered
V

10

20

I start a new project in laravel but my composer installed a fresh version of laravel 6.0.1.

Php artisan make:auth command can't work.

I try many times but error can't remove

composer require laravel/ui

installed but when I use the second command:

php artisan ui vue --auth

then system show me this message:

Command "ui" is not defined.
Using version ^1.0 for laravel/ui
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php on line 129

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php on line 129

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.
Viehmann answered 9/9, 2019 at 16:1 Comment(1)
Shouldn't you deal with the fatal error thrown by your PHP before worrying about laravel UI, lack of memory can create issues for ComposerStaves
M
36

you can try this:

 C:\Whatever\Your_project_name>composer require laravel/ui

and

 C:\Whatever\Your_project_name>php artisan ui vue --auth

Just this two inside your project folder.I am using vue but you can try other ones too.

Mcmichael answered 26/9, 2019 at 8:4 Comment(2)
when i use second command it still says " ui command is not defined" . why? i'm using laravel 7Lemmuela
Note: You will need to specify a version for laravel ui if you are installing an older version of the framework. For Laravel 6 the command is composer require laravel/ui "1.*" and I believe laravel 7 is composer require laravel/ui "2.*"Wanettawanfried
D
9

Did you install the dependency? To run that command you need to install an additional package:

composer require laravel/ui

After this you should be able to run one of these commands:

php artisan ui bootstrap
php artisan ui vue
php artisan ui react

In case you need the auth views, you could:

php artisan ui bootstrap --auth
php artisan ui vue --auth
php artisan ui react --auth

Don't forget to run this after:

npm install
Desensitize answered 9/9, 2019 at 16:5 Comment(3)
Are you sure that you have installed the mentioned package?Desensitize
@AbhishekThakur it looks like you have an infinite loop that is using all the memory, check this post to know more about this error and possible solutions.Desensitize
not worked, i try maximun solution but not worked in there, composer install in system but UI not defindViehmann
F
2

The same error hits me in the new version of Laravel 7.x, What I did the process is really simple: if your composer is old version and the terminal or cmd is giving you warnings to update it using some package then there are chances that the above error hits you.


Solution:

  • Step 1 : Try the following two commands in your normal terminal not of your project directory. The below command will only update the composer.

       composer self-update
    

    OR use the below command (it will update your dependencies plus your composer)

       composer update
    

    When you composer gets updated. check the composer by the below command

       composer --version
    

  • Step 2 : First go to your project root folder C:\Whatever\Your_project_name>

       composer require laravel/ui
    

    Try any of the below command according to your front end framework.

       php artisan ui vue --auth
       php artisan ui bootstrap --auth
       php artisan ui react --auth
    

    At the end don't forget to run

       npm install
    

    If your User Interface is not working properly try below command.

       npm run production
    

Forbes answered 14/5, 2021 at 17:13 Comment(0)
K
1

run "composer require laravel/ui 1" instead of "composer require laravel/ui"

laravel 6 works with version 1.0, it written in docs "Want to get started fast? Install the laravel/ui (1.0)"

Kellerman answered 18/3, 2020 at 20:50 Comment(0)
M
1

I was facing the same issue is laravel 8.0, whenever i tried to run this command

php artisan ui vue -auth

after installing the laravel/ui package I was getting the error

command UI is not defined

I fixed this issue by using this command

composer update

it automatically install the laravel/ui package into my project and then I run this command to install the required auth for my web app.

`php artisan ui vue -auth`
Makeyevka answered 17/1, 2021 at 10:1 Comment(0)
A
0

You need to create another new project. You can try this:

composer config -g repo.packagist composer https://packagist.phpcomposer.com
composer create-project --prefer-dist laravel/laravel project2 "7.0.*"
composer require laravel/ui

php artisan ui vue --auth
Albumose answered 10/8, 2020 at 3:26 Comment(0)
N
0

Just add the version in command line as well:

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

Check this too.

Nisus answered 11/8, 2020 at 13:6 Comment(1)
Please don't post a code only answer without including a textual explanation in the post itself.Kessinger
B
0

using

composer require laravel/ui:*

worked for me

Brambling answered 19/2, 2022 at 9:43 Comment(0)
W
0

I recently faced this issue after upgrading from laravel 6 to 8. Installing laravel/ui did not work for me because the package was already installed.

I solved it by manually deleting cache folder at bootstrap/cache

Wellknit answered 16/9, 2022 at 19:49 Comment(0)
V
0

I have just started learning laravel and facing the same issue. I have not proper idea about proper way to start learning laravel. So I did the silly mistake.

I have installed composer using

composer create-project laravel/laravel EMS
composer require laravel/ui

Then opened EMS(laravel project's folder) in command prompt. and ran

php artisan ui bootstrap

So, I got error ui not defined, My mistake was I ran composer command out of the project folder, and artisan command in project. So I have ran all above command in project's folder and everything is working fine.

I don't know this is correct way to do this or not, but my issue is solved using this method. So, I thought to share with users, if my way is wrong than anyone can also suggest better way.

Vinnievinnitsa answered 28/3, 2023 at 5:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.