对于我当前的composer项目,我需要使用以下依赖项:
"lokielse/omnipay-alipay" : "dev-master",
"lokielse/omnipay-wechatpay" : "dev-master"
但当我运行命令时:
composer update --with-all-dependencies
我收到这个错误消息:
Could not scan for classes inside "vendor/alipay" which does not appear to be a file nor a folder
知道我该怎么解决吗?谢谢
更新1:这是有关该问题的一些附加信息。
- 我检查了供应商文件夹,创建了非支付宝文件夹
- 这是原始的composer.json文件内容:
{
"name" : "muvizuworld",
"description" : "The Laravel Framework.",
"require" : {
"php" : "^7.3|^8.0",
"ext-curl" : "*",
"ext-json" : "*",
"alibabacloud/sdk" : "^1.8",
"darkaonline/l5-swagger" : "^8.0",
"dcat/laravel-admin" : "2.*",
"fideloper/proxy" : "^4.4",
"fruitcake/laravel-cors" : "^2.0",
"genealabs/laravel-model-caching" : "^0.11.1",
"guzzlehttp/guzzle" : "^7.0.1",
"hhxsv5/laravel-s" : "^3.7",
"iidestiny/laravel-filesystem-oss" : "^2.1",
"laravel/framework" : "^8.12",
"laravel/horizon" : "^5.7",
"laravel/tinker" : "^2.5",
"lcobucci/jwt" : "3.3.3",
"overtrue/laravel-wechat" : "^6.0",
"predis/predis" : "^1.1",
"simplesoftwareio/simple-qrcode" : "^4.1",
"tymon/jwt-auth" : "^1.0",
"xuxiaoyang/laravel-model-trait" : "^1.0",
"ignited/laravel-omnipay" : "2.*",
"lokielse/omnipay-alipay" : "dev-master",
"lokielse/omnipay-wechatpay" : "dev-master",
"ext-zip" : "*"
},
"require-dev" : {
"barryvdh/laravel-ide-helper" : "^2.8",
"beyondcode/laravel-dump-server" : "^1.7",
"beyondcode/laravel-query-detector" : "^1.4",
"codedungeon/phpunit-result-printer" : "^0.30.0",
"facade/ignition" : "^2.5",
"fakerphp/faker" : "^1.9.1",
"mockery/mockery" : "^1.4.2",
"nunomaduro/collision" : "^5.0",
"phpunit/phpunit" : "^9.3.3"
},
"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" ],
"ide" : [ "@php artisan ide-helper:generate", "@php artisan ide-helper:meta", "@php artisan ide-helper:model --write" ],
"clear" : [ "@php artisan cache:clear", "@php artisan config:cache" ]
},
"autoload-dev" : {
"psr-4" : {
"Tests\" : "tests/"
}
},
"keywords" : [ "framework", "laravel" ],
"minimum-stability" : "dev",
"prefer-stable" : true,
"extra" : {
"laravel" : {
"dont-discover" : [ ]
}
},
"autoload" : {
"classmap" : [ "vendor/alipay" ],
"psr-4" : {
"App\" : "app/",
"Database\Factories\" : "database/factories/",
"Database\Seeders\" : "database/seeders/"
},
"files" : [ "bootstrap/helpers.php" ]
},
"config" : {
"optimize-autoloader" : true,
"preferred-install" : "dist",
"sort-packages" : true,
"allow-plugins" : {
"easywechat-composer/easywechat-composer" : false
}
},
"license" : "MIT",
"type" : "project"
}
更新2:删除行之后
"classmap" : [ "vendor/alipay" ]
错误输出已更改:
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- php-http/guzzle6-adapter v0.1.0 requires guzzlehttp/guzzle ~6.0 -> found guzzlehttp/guzzle[6.0.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1).
- php-http/guzzle6-adapter[v0.2.0, ..., v0.2.1] require php-http/client-tools ^0.1 -> could not be found in any version, there may be a typo in the package name.
- php-http/guzzle6-adapter[dev-master, v0.3.0, ..., v0.4.1, v1.0.0, ..., v1.1.1, v2.0.0, ..., 2.x-dev] require guzzlehttp/guzzle ^6.0 -> found guzzlehttp/guzzle[6.0.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1).
- lokielse/omnipay-wechatpay dev-master requires php-http/guzzle6-adapter * -> satisfiable by php-http/guzzle6-adapter[dev-master, v0.1.0, ..., v0.4.1, v1.0.0, v1.1.0, v1.1.1, v2.0.0, v2.0.1, v2.0.2, 2.x-dev].
- Root composer.json requires lokielse/omnipay-wechatpay dev-master -> satisfiable by lokielse/omnipay-wechatpay[dev-master].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
更新3:我认为与您分享一些信息很重要:
- 我正在做的项目是由另一个我不再联系的开发人员制作的遗留应用程序。因此,我现在的目标是让应用程序的本地/功能副本运行。目前,有一个带有此代码的生产站点,所以据说它可以工作
- 如果我不删除";类映射";在Updated 2中提到的行,然后什么都没有改变,我一直停留在第一条错误消息中
- 对于新的错误消息,我注意到依赖版本之间存在冲突:phphttp://guzzle6适配器需要guzzlehttp://guzzle的版本,但composer.json文件请求更高的版本。正如我之前提到的,我没有创建这个.json文件,我只需要让它工作,所以我尝试降级guzzlehttp://guzzle包的版本以避免冲突,但后来我收到了新的错误消息。所以,我想知道是否有任何策略可以从头开始重建composer.json文件,这样我就可以一个接一个地添加正确的依赖项了?你有什么策略可以建议我从头开始吗?谢谢
知道我该怎么解决吗?
您描述的错误是Composer转储自动加载器时的错误。
这是一个非常基本的操作,默认情况下,每次安装composer和更新composer时都会发生这种情况。
从错误消息中也可以相对容易地找到它:
无法扫描"中的类;CCD_ 1";它看起来既不是文件也不是文件夹[由我格式化]
它已经告诉了你两件重要的事情:
- Composer正在扫描类。这是为了创建一个所谓的类映射
- Composer遇到问题的路径:
vendor/alipay
从Composer项目配置中删除错误的自动加载配置,错误消息就会消失。
因为之后会出现依赖性问题,所以必须解决这些问题。由于这些都是过时的,除了你必须解决它们之外,没有什么好说的了(尤其是在以前的开发人员没有更多帮助的情况下,现在必须解决它们的是你,是的,你(。
然后,或者在两者之间,你甚至可能会知道为什么会有这个类映射,它会给你带来最初的错误。
以前形式的配置显然被破坏了。也许如果你可以恢复一个曾经工作过的composer.lock修订版,它可能会再次安装,但这只是一个提示,不知道这是否是项目的远程选项。