当尝试在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.
! >
关于如何解决这个问题,没有太多信息。否则,我应该如何指定正在使用composer 2?所有东西都是从composer 2安装的。
composer.json
{
"autoload": {
"psr-4": {
"App\": "app/"
},
"files": [
"App/helpers.php"
]
},
"require": {
"vlucas/phpdotenv": "^5.4",
"abraham/twitteroauth": "^3.2",
"jenssegers/blade": "^1.4",
"bramus/router": "^1.6",
"nesbot/carbon": "^2.55",
"phpfastcache/phpfastcache": "*",
"php": ">=8.0"
}
}
composer——版本
Composer version 2.2.1 2021-12-22 22:21:31
问题出在composer的确切版本上,heroku使用composer版本2.1.14(https://devcenter.heroku.com/articles/php-support#installation-依赖项(,我的作曲家是2.2.1。
我用以下方法修复了它:
移除composer.lock&供应商
composer self-update 2.1.14
composer install