4

After creating a project by typing

laravel new "first-project" 

I am writing the below code but is causes an error

php artisan serve

Could not open input file: artisan

Screenshot

Mathew Tinsley
  • 6,805
  • 2
  • 27
  • 37

3 Answers3

4

The laravel new [project name] command creates a new project in a subdirectory. You need to cd into that subdirectory.

laravel new "first-project"
cd first-project
php artisan serve

From the installation documentation:

the laravel new command will create a fresh Laravel installation in the directory you specify. For instance, laravel new blog will create a directory named blog containing a fresh Laravel installation with all of Laravel's dependencies already installed

Mathew Tinsley
  • 6,805
  • 2
  • 27
  • 37
1

Perhaps you would like to make the current working directory the directory that was just created for the project you just created.

lagbox
  • 48,571
  • 8
  • 72
  • 83
0

"You need to be inside first-project folder .."

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 first-project

Now you will be able to run any artisan commands, for example running

php artisan

will display you list of available commands.

Tpojka
  • 6,996
  • 2
  • 29
  • 39
Nims Patel
  • 1,048
  • 9
  • 19