[Solved] Could not open input file: artisan

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

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.

Respondent: Marcin Nabia?ek

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 ...

Respondent: cyber8200

Solution #4:

Most probably you are not in the right directory!

Respondent: zaffar

Solution #5:

I just needed to make artisan executable.

chmod +x artisan

…and it works without the php prefix then.

Respondent: Kevin Carmody

Solution #6:

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.


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

Where to open terminal

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

Laravel terminal code to start server

php artisan serve --host

Respondent: John Zenith

Solution #7:

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

Respondent: Napster Scofield

Solution #8:

I also had the problem i just installed but forgot to jump the created project folder.
So you need to jump your project folder.

cd project_name

and then serve php artisan command

Respondent: Arman H

Solution #9:

Just make sure you are in the project folder by typing


If not then go to the project folder by typing

 cd folder_name

for example:

cd laravel

And then type

php artisan serve

Respondent: Aamir Kalimi

Solution #10:

If it is your first install of laravel then create another directory/folder inside the laravel directory and then move to that empty folder and create another project using the command below:

composer create-project --prefer-dist laravel/laravel blog

This will create a new project named “blog”, then go back to parent laravel directory and now you can run this command:

php artisan serve

You will receive the return such as:

laravel deployment server started: http://localhost:8000

See attached image
enter image description here

Respondent: A.Aleem11

Solution #11:

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 ....

Respondent: Busted

Solution #12:

Try executing it as sudo.

sudo laravel new blog

Your file may not have the appropriate permissions. Let us know if it worked!

Respondent: Eduardo Kasper

Solution #13:

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 '' > artisan

You probably want to choose a tagged version that matches your installed version of Laravel.

Respondent: DavidM

Solution #14:

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!

Respondent: TeeJay

Solution #15:

This error happens because you didn’t install composer on your project.

run composer install command in your project path.

Respondent: Ali Lashini

Solution #16:

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.

Respondent: Malith Senanayake

Solution #17:

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

Respondent: pardeep

Solution #18:

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

Respondent: Adjeiinfo

Solution #19:

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

 cd projectName
Respondent: Ravi Mane

Solution #20:

After installing composer, you need to create the project:

composer create-project laravel/laravel /path/to/tour/project

You can see the documentation, for your php version the lastest Laravel you can install is 5.0.

Now days here is the lastest version and require > php7.0. Here is the documentation.

Respondent: Talan

Solution #21:

What did the trick for me was to do cd src from my project directoy, and then use the php artisan command, since my artisan file was in the src folder. Here is my project structure:

|__ config
|__ src
    |__ app
    |__ ..
    |__ artisan  // hello there!
    |__ ...
|__ ...
Respondent: Aleksandar

Solution #22:

if you re in say my-project/app/somefolder run in terminal cd .. two times to get in my-project/ folder

Respondent: CodeToLife

Solution #23:

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.

Example : C:xampp newhtdocsproject laravelLaravelProject>php artisan serve

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

enter image description here

Respondent: Aslam Khan

Solution #24:

-> 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.

Respondent: sh6210

Solution #25:

Just try and execute the command in directory where all laravel code resides. Happened with me too, I was trying to run the command in project’s root folder, but the code was in a sub directory

Respondent: Ajjay Arora

Solution #26:

First create the project from the following link to create larave 7 project: Create Project

Now you need to enter your project folder using the following command:

cd myproject

Now try to run artisan command, such as, php artisan.

Or it may happen if you didn’t install compose. So if you didn’t install composer then run composer install and try again artisan command.

Respondent: Md Riadul Islam

Solution #27:

Check the directory in CMD console, it should be the same as the project .

C:...project directory


D:...project directory
Respondent: amine

Solution #28:

Another thing to note that if you have a symbolic link from a non public location which hosts your project code to say public_html – running php artisan in the symbolic link location (public_html) will result in this error.
You seem to need to be in the actual project directory for php artisan to work.

Respondent: SupaMonkey

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy