Could not open input file: artisan

后端 未结 27 954
清歌不尽
清歌不尽 2020-11-30 17:45

When trying to create a new laravel project, The following error appears on the CLI:

Could not open input file: artisan

Script php artisan clear-c

相关标签:
27条回答
  • 2020-11-30 18:13

    First, be sure to be in the laravel project folder or else the terminal won't be able to locate the artisan file in the project directory and any subsequent request you pulled to start a server would be rejected.

    Demo

    Let's say our laravel project name is blog and located in C:\laravel We then have: C:\laravel\blog

    Where to open terminal

    Navigate to the C:\laravel\blog directory and open the command window (terminal). Input the code below:

    Laravel terminal code to start server

    php artisan serve --host 127.0.0.1

    0 讨论(0)
  • 2020-11-30 18:14

    You must must be in your Laravel Project Folder

    When creating a new project with laravel new project-name, a folder will be created with your project name as name. You must get in that folder before using any php artisan command like php artisan serve because the artisan file is in that folder

    0 讨论(0)
  • 2020-11-30 18:14

    The very first thing you have to check in this error is whether you are in the right folder. Direct the command prompt inside the project folder where all the Laravel package is existing.

    0 讨论(0)
  • 2020-11-30 18:17

    I think you are not into laravel project directory please simply go to laravel project directory by using following command

     cd projectName
    
    0 讨论(0)
  • 2020-11-30 18:19

    You need to first create Laravel project and if you already have one you need to go to this project dir using cd command in terminal for example cd myproject.

    Now you will be able to run any artisan commands, for example running php artisan will display you list of available commands.

    0 讨论(0)
  • 2020-11-30 18:19

    Most probably you are not in the right directory!

    0 讨论(0)
提交回复
热议问题