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
After creating the project you should move in the folder before issuing the command
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!You cannot use
php artisan
if you are not inside alaravel
project folder.That is why it says
'Could not open input file - artisan'
.-> 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.
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 commandphp artisan ....
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 inC:\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