Could not open input file: artisan
Solution 1
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.
Solution 2
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'
.
Solution 3
If you project is at /home/forge/laravel-project/
You can properly execute your artisan like this
php /home/forge/laravel-project/artisan ...
Solution 4
Most probably you are not in the right directory!
Solution 5
I just needed to make artisan
executable.
chmod +x artisan
...and it works without the php prefix then.
wessodesigner
Updated on February 18, 2022Comments
-
wessodesigner about 2 years
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
-
wessodesigner over 9 yearsThis error appears when I am attempting to create a new laravel project: cd xampp/htdocs then composer create-project laravel/laravel newLaravelProject It starts to download all the required dependencies, and suddenly this error appears.
-
Eranda almost 9 yearsIf you have moved your app folder with .env, vendor folder, config folder...etc to some where else, you may have to change directory root to this location.
-
Chad over 5 yearsThis should be the selected answer. Worked perfectly!
-
Admin over 5 yearsof course you have to do a
composer install
almost one time -
Dmitry almost 4 yearsIn Windows you can do
php 'E:\path\to_your_domain\artisan' october:up
-
Yvon Huynh over 3 yearsI tried to make a migration from the migration folders, I hasd this message, you've got to be at the root of your application (where composer.json resides) to make it work
-
raw-bin hood over 3 yearsAgreed. correct answer here. I didn't know that it only worked from the project root folder.
-
Monir alhussini over 3 yearsI am facing an issue like this one if anyone ca help with it stackoverflow.com/questions/64983129/…