-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/php
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
! ERROR: Failed to install system packages!
!
! Your platform requirements (for runtimes and extensions) could
! not be resolved to an installable set of dependencies, or a
! platform package repository was unreachable.
!
! This usually means that you (or packages you are using) depend
! on a combination of PHP versions and/or extensions that are
! currently not available on Heroku.
!
! The following is the full output from the installation attempt:
!
! > You are using Composer 1 which is deprecated. You should upgrade to Composer 2, see https://blog.packagist.com/deprecating-composer-1-support/
! > 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.1.1, 8.1.0, 8.0.14, 8.0.13, 8.0.12, 8.0.11, 8.0.10,
! 8.0.9, 8.0.8, 8.0.7, 8.0.6, 8.0.3, 8.0.2, 8.0.1, 8.0.0,
! 8.0.0RC4, 7.4.27, 7.4.26, 7.4.25, 7.4.24, 7.4.23, 7.4.22,
! 7.4.21, 7.4.20, 7.4.19, 7.4.16, 7.4.15, 7.4.14, 7.4.13,
! 7.4.12, 7.3.33, 7.3.32, 7.3.31, 7.3.30, 7.3.29, 7.3.28,
! 7.3.27, 7.3.26, 7.3.25, 7.3.24
!
! 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.
!
! When choosing a PHP runtimes and extensions, please also ensure
! they are available on your app's stack (heroku-20), and select
! a different stack if needed after consulting the article below.
!
! 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
Coeds above are the error I am getting when I deploy the app, the app runs perfectly fine locally, I am not sure what happened during the deployment.
composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.1.1",
"composer-plugin-api": "^2.2",
"dcat/laravel-admin": "^1.7",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.5.10",
"composer/composer": "^2.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
Error 1
The requested package composer-plugin-api could not be found in any version, there may be a typo in the package name.
Error 2
I am using Composer version 2.2.1, why it shows that i am using composer 1 during the deployment?
Error 3
In the composer.json
file, I have required PHP 8.1.1, why does it still say that I am not using the correct version?
CodePudding user response:
It looks like the Heroku server your are using for deploying your application does not support the composer version used locally.
As you are using heroku-20
, make sure you use Composer 1.10.* or 2.1.*
My assumption is that you updated Composer to 2.2.x which may not be supported at the moment. You should downgrade to Composer 2.1.14 then run composer update
again.
composer self-update --rollback
composer -v # Should be 2.1.14
composer update