drsw9390405 2014-02-24 17:24
浏览 126
已采纳

无法执行Laravel工匠命令

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 --create

This triggers the following error:

Could not open input file: artisan

I have tried a number of things I found here on this site, but nothing seems to work. Any suggestions on how to make it work?

  • 写回答

4条回答 默认 最新

  • doulin2947 2014-02-24 17:44
    关注

    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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染