问题
After setting up Homestead for 1 specific project only, I want to run the Artisan CLI for database migrations. I tried to follow this tutorial and I keep getting this error:
Could not open input file: artisan
I set up the project by running these commands (Windows):
composer require laravel/homestead --dev
vendor\\bin\\homestead make
vagrant up
And then I made sure to be in the root project directory and then run php artisan list
, which gives the error above.
I also tried to ssh into the Homestead VM and navigated to the code
folder (where my project resides) and run php artisan list
, to which it gives the same error.
Attached is my working directory where I run the artisan command, as requested:
I have tried running it in root dir and in vendor\\laravel
to no avail.
So how would one run the artisan CLI in a Laravel Homestead project?
回答1:
I think I've figured it out. The problem was that I haven't set up a Laravel project using composer
yet, and skipped to install Laravel Homestead for this project.
So to make a Laravel project named e.g. quickstart
, one should first create the project by running
composer create-project laravel/laravel quickstart --prefer-dist
(see https://laravel.com/docs/5.1/quickstart#installation for more details)
Only after that, set up homestead for the project by running
composer require laravel/homestead --dev
vendor\bin\homestead make
And now the project should be fully initialized.
Refs: https://laravel.com/docs/5.7/homestead#per-project-installation
来源:https://stackoverflow.com/questions/53862658/cannot-run-artisan-command-in-laravel-homestead