[英]I am using composer to autoload the file but when i run my code he is not able to find the class
[英]Heroku detects composer 1 when I am using composer 2
嘗試在 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.
! >
關於如何解決此問題的信息不多。 我還應該如何指定正在使用作曲家 2? 一切都是從作曲家 2 安裝的。
作曲家.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 version 2.2.1 2021-12-22 22:21:31
問題是確切的作曲家版本,heroku 適用於作曲家版本 2.1.14( https://devcenter.heroku.com/articles/php-support#installation.-2 )。
我用以下方法修復了它:
刪除 composer.lock 和 vendor
composer self-update 2.1.14
composer install
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.