Unable to execute Laravel artisan commands

后端 未结 5 1817
南方客
南方客 2021-02-01 16:39

I just installed the latest version of Laravel and tried to run the following command from my Git Bash:

php artisan migrate:make create_users_table --table=users         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 17:07

    tl;dr

    Run composer install in your project's root folder.

    Explanation

    This happens when you create a project by downloading and extracting the laravel/laravel repo from GitHub, not by using the Composer command:

    composer create-project laravel/laravel your-project-name
    

    In this case the dependencies are not installed, so the vendor folder that contains Artisan doesn't exist. Running composer install in your project's root folder will install the dependencies vendor folder.

    For more, see my other answer on how to install Artisan.

    Side note

    This is independent from your problem but your Artisan command is a bit deficient. You forgot =users (the table name) from the end. Also if you create a table you dont have to specify the table name again with the --table option so this command would be enough:

    php artisan migrate:make create_users_table --create=users
    

提交回复
热议问题