composer: Composer can not find composer.json file
My composer.json
:
C:\Users\jeffr\desktop\dce\dceu
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"doctrine/dbal": "^2.9",
"fideloper/proxy": "^4.0",
"google/recaptcha": "~1.1",
"intervention/image": "^2.5",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"uxweb/sweet-alert": "^2.0"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
Output of composer diagnose
:
$ composer diagnose
Checking platform settings: OK
Checking git settings:
[ErrorException]
proc_open(NUL): failed to open stream: No such file or directory
diagnose
When I run this command:
composer install
or composer update
I get the following output:
$ composer install
Composer could not find a composer.json file in C:\Users\jeffr\desktop\dce\dceu
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
$ composer update
Composer could not find a composer.json file in C:\Users\jeffr\desktop\dce\dceu
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
And I expected this to happen: it should install or update my packages
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18
Got the same issue after updating Windows and found out it was because the project folder was in a OneDrive shared folder. Moving the project folder out of OneDrive solved the issue.
I’m pretty sure it was Windows’ today update in my case. To revert, just: Windows Settings -> Update & Security -> Recovery -> Go back to previous version of Windows 10
To install composer and add to your global path:
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
Ho do you resolve the same error hen using linux, i even changed path to compose location and still getting 'Composer could not find a composer.json file in /usr/local/bin To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ “Getting Started” section ’