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 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误