Creating New Laravel Project Fails When Using Composer Create-project
I'm trying to create a new Laravel project for use within Homestead, as I have successfully many times in the past, and have issued the following command:
composer create-project --prefer-dist laravel/laravel test
But unfortunately it fails with
Composer could not find a composer.json file in /home/vagrant/code/test... and leaves the "test" folder empty.
The full output is here:
1/2: http://repo.packagist.org/p/provider-latest$d0bd0b2315439b65010ddf266ff3cd834b7f92edb850d5dd1f8a40c44586751f.json 2/2: http://repo.packagist.org/p/provider-2019-04$0835fd3847a1c8f8d46ee6dd6da638ec6e9846bf1dce10d9b2f10a0e953bbd04.json Finished: success: 2, skipped: 0, failure: 0, total: 2 1/2: http://repo.packagist.org/p/provider-latest$d0bd0b2315439b65010ddf266ff3cd834b7f92edb850d5dd1f8a40c44586751f.json 2/2: http://repo.packagist.org/p/provider-2019-04$0835fd3847a1c8f8d46ee6dd6da638ec6e9846bf1dce10d9b2f10a0e953bbd04.json Finished: success: 2, skipped: 0, failure: 0, total: 2 Installing laravel/laravel (v5.8.17) - Installing laravel/laravel (v5.8.17): Loading from cache Created project in test [InvalidArgumentException] Composer could not find a composer.json file in /home/vagrant/code/test To initialize a project, please create a composer.json file as described in the https://getcomposer.or g/ "Getting Started" section create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]
Some context: I recently updated my Homestead vagrant box to v8.0.0 and Homestead source code to v9.0.1 (and then downgraded to v8.0.1 due to strange behaviour as described here). The create-project problem reported above occurs using both Homestead v9.0.1 and v8.0.1.
I tried adding an empty composer.json file to the "test" folder, but that results in a
"./composer.json" does not contain valid JSON error.
I even copied in the composer.json file from the laravel/laravel project, but that results in a
Could not scan for classes inside "database/seeds" which does not appear to be a file nor a folder run-time exception (which is correct because the "test" folder comprises only a "vendor" folder, a composer.json file and a composer.lock file).
I've been going around in circles for a couple of days now, so any assistance would be greatly appreciated.
So it turned out to be a permission problem, great.
What I do, and I don't use Homestead but Docker (it is similar though) is, I DON'T run Composer commands nor Laravel commands from the HOST, but from inside the virtual machine.
That way you don't have to
sudo chmod -R a+rwx /home/vagrant/code/test which is bad (as it gives user, group and others read/write/execute permissions)
Just ssh into your Homestead machine, run
composer create-project --prefer-dist laravel/laravel test and later
php artisan package:discover and you should avoid all this trouble.
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms