Could not open input file: artisan

2019-01-12 17:24发布

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-compiled handling the post-install-cmd event returned with an error

I am using the latest version of XAMPP v3.2.1 with PHP 5.5.15 and with mcrypt enabled (made sure of that by issuing the command php -m). And I am running windows 8.1

17条回答
我欲成王,谁敢阻挡
2楼-- · 2019-01-12 17:54

After creating the project you should move in the folder before issuing the command

查看更多
混吃等死
3楼-- · 2019-01-12 17:57

If you're running your Laravel project in Vagrant and have just SSH-ed into the virtual machine, don't forget to cd /vagrant before you try running artisan commands!

查看更多
等我变得足够好
4楼-- · 2019-01-12 17:58

You cannot use php artisan if you are not inside a laravel project folder.

That is why it says 'Could not open input file - artisan'.

查看更多
我只想做你的唯一
5楼-- · 2019-01-12 18:00

-> cd ..

-> cd project_dir

-> php artisan ('works fine')

in my case, i removed the directory and again clone the repo from the same directory through terminal. then i went one step back and step into my project folder again and the problem was gone.

查看更多
三岁会撩人
6楼-- · 2019-01-12 18:01

After struggling with this issue, I found out that you need to find where artisan resides by running sudo find / -name artisan, and from there run the command php artisan ....

查看更多
对你真心纯属浪费
7楼-- · 2019-01-12 18:03

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

查看更多
登录 后发表回答