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
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 ....
First go to the Laravel folder then type the artisan commands like if your Laravel app name "Demopro"
so open cmd and with the help of cd command go in the Demopro and then use artisan command
Just make sure you are in the project folder by typing
ls
If not then go to the project folder by typing
cd folder_name
for example:
cd laravel
And then type
php artisan serve
Try executing it as sudo
.
sudo laravel new blog
Your file may not have the appropriate permissions. Let us know if it worked!
I checked out an existing Laravel project, which did not have this script. Even a find / -name 'artisan'
produced no results. The solution turned out to be simple, if a bit weird:
curl -L 'https://raw.githubusercontent.com/laravel/laravel/v4.2.11/artisan' > artisan
You probably want to choose a tagged version that matches your installed version of Laravel.
-> 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.