xtingray
xtingray

Reputation: 503

Composer error when installing alipay dependency

For my current composer project, I need to use these dependencies:

"lokielse/omnipay-alipay" : "dev-master",
"lokielse/omnipay-wechatpay" : "dev-master"

But when I run the command:

composer update --with-all-dependencies

I got this error message:

Could not scan for classes inside "vendor/alipay" which does not appear to be a file nor a folder

Any idea how I can solve it? Thanks.

Update 1: This is some additional information about the issue.

  1. I checked inside the vendor folder and non alipay folder is created.
  2. This is the original composer.json file content:
{
  "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"
}

Update 2: After I removed the line

"classmap" : [ "vendor/alipay" ]

The error output changed:

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.

Update 3: Some information I think it's important to share with you:

  1. The project I am working on it is a legacy application made by another developer I have no contact anymore with. So, my goal right now is to get a local/functional copy of the application running. Currently, there is a production site with this code, so supposedly it works.
  2. If I don't remove the "classmap" line mentioned in the Updated 2, then nothing changes and I keep stuck in the first error message.
  3. For the new error message, I noticed that there is a conflict between dependency versions: php-http/guzzle6-adapter requires a version of guzzlehttp/guzzle, but the composer.json file is requesting a higher version. As I mentioned before, I didn't create this .json file, I just have to make it work, so I tried downgrading the version of the guzzlehttp/guzzle package to avoid the conflict, but then I got new error messages. So, I wonder if is there any strategy to rebuild the composer.json file from scratch, so I can add the right dependencies one by one? Is there any strategy you could suggest me at all to start from the beginning? Thanks.

Upvotes: -1

Views: 615

Answers (1)

hakre
hakre

Reputation: 198109

Any idea how I can solve it?

The error you describe is an error while Composer is dumping the autoloader.

This is a very basic operation and it happens with each composer install and composer update by default.

From the error message it is also relatively easy to locate it:

Could not scan for classes inside "vendor/alipay" which does not appear to be a file nor a folder [formatting by me]

It already tells you two important things:

  1. Composer was scanning for classes. This is for creating a so called classmap.
  2. The path where Composer was having a problem with: vendor/alipay

Remove that errorneous autoload configuration from your Composer project configuration and the error message goes away.


As afterwards you have dependency issues, you have to resolve them. As those are stale, there is not much to tell, other than that you have to resolve them (especially as there is no more help from the previous developers, it is now you who have to resolve them, yes, you).

And afterwards or in between you might then even learn why there was this classmap in there that got you the original error.

The configuration in its previous form was obviously broken. Perhaps if you can restore a once working composer.lock revision it may install again, but that is just a hint, no idea if that is even remotely an option for the project.

Upvotes: 0

Related Questions