I simply tried to follow the Heroku guide to create a simple laravel app (even without db connection) and deploy on a Heroku app. However, it appears that when using Composer 2 there are problems (see log here). Rolling back to Composer 1 is all right.
In the Heroku documentation it is indicated that Composer 2 is supported but obviously I am doing something wrong since it gives me an error.
when I push modifications to Heroku i get this error:
! The following is the full output from the installation attempt:
!
! > Loading repositories with available runtimes and extensions
! > Updating dependencies
! > Your requirements could not be resolved to an installable set of packages.
! >
! > Problem 1
! > - The requested package composer-plugin-api could not be found in any version, there may be a typo in the package name.
! >
!
! For reference, the following runtimes are currently available:
!
! PHP: 8.0.6, 8.0.3, 8.0.2, 8.0.1, 8.0.0, 7.4.19, 7.4.16,
! 7.4.15, 7.4.14, 7.4.13, 7.4.12, 7.4.11, 7.4.10, 7.4.9,
! 7.4.8, 7.4.7, 7.4.6, 7.4.5, 7.4.4, 7.4.3, 7.4.2, 7.3.28,
! 7.3.27, 7.3.26, 7.3.25, 7.3.24, 7.3.23, 7.3.22, 7.3.21,
! 7.3.20, 7.3.19, 7.3.18, 7.3.17, 7.3.16, 7.3.15, 7.3.14,
! 7.3.13, 7.2.34, 7.2.33, 7.2.32, 7.2.31, 7.2.30, 7.2.29,
! 7.2.28, 7.2.27, 7.2.26, 7.1.33
!
! Please verify that all requirements for runtime versions in
! 'composer.lock' are compatible with the list above, and ensure
! all required extensions are available for the desired runtimes.
!
!
! For a list of supported runtimes & extensions on Heroku, please
! refer to: https://devcenter.heroku.com/articles/php-support
! Push rejected, failed to compile PHP app.
! Push failed
I tried with
composer require composer-plugin-api
But still get error. I use PHP 7.4.19 and my app is done with Laravel 7.
Here is the content of my composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"composer-plugin-api": "^2.1",
"barryvdh/laravel-ide-helper": "^2.6",
"doctrine/dbal": "^2.10",
"fideloper/proxy": "^4.2",
"guzzlehttp/guzzle": "^6.5",
"jeroenzwart/laravel-csv-seeder": "^1.2",
"kris/laravel-form-builder": "^1.22",
"laravel-frontend-presets/bulma": "^3.0",
"laravel/framework": "^6.12",
"laravel/scout": "^7.2",
"laravel/tinker": "^2.1",
"league/csv": "^9.5",
"michelf/php-markdown": "^1.9",
"nesbot/carbon": "^2.29",
"proengsoft/laravel-jsvalidation": "^2.5",
"psr/log": "^1.1",
"spatie/laravel-collection-macros": "^6.0",
"spatie/laravel-permission": "^3.6",
"spatie/laravel-searchable": "^1.5",
"yajra/laravel-datatables": "^1.5"
},
"require-dev": {
"facade/ignition": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
},
"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"
]
}
}
Thanks
3
Answers
Just an update: I also used this guide provided by Heroku devcenter to create a simple laravel app and deploy it on heroku and i got the same result.
I suppose it could be a problem with Composer 2, but reading Heroku docs I understood Heroku support Composer 2
At the moment the only way I have found to solve seems to be to bring Composer back to version 1. In doing so, heroku accepted the deployment.
Bug closed. Now it works.
Github ticket