ホーム > Laravel > How to Deal with Issues when composer require Command Doesn't Work Properly with Versions
Laravel

How to Deal with Issues when composer require Command Doesn't Work Properly with Versions

Thank you for your continued support.
This article contains advertisements that help fund our operations.

⇨ Click here for the table of contents for Laravel articles

I encountered an error related to version compatibility when I tried to install the package called weidner/goutte.

Laravel 6.20

Problem 1

- Root composer.json requires weidner/goutte ^2.1 -> satisfiable by weidner/goutte[2.1.0].
- weidner/goutte 2.1.0 requires illuminate/support ^8 -> found illuminate/support[v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.

Here, I will provide the steps to address this error.

Solution

Add to composer.json

"weidner/goutte": "^1.6"

Command

composer update

Explanation or Reflection, or Conclusion

I tried various commands, but since Laravel 6 is quite old, it was difficult to resolve the issue.

According to the documentation, for Laravel 6, it states to include

"weidner/goutte": "^1.6"

However, when trying to install that, it seemed that it was not working unless I downgraded other packages like Guzzle.

As a result, the version changes were as follows.

- Removing psr/http-client (1.0.1)
  - Locking fabpot/goutte (v3.3.1)
  - Downgrading guzzlehttp/guzzle (7.3.0 => 6.5.5)
  - Locking symfony/browser-kit (v5.3.4)
  - Locking symfony/dom-crawler (v5.3.7)
  - Locking weidner/goutte (1.6.1)

Conclusion

That's all. Understanding package version dependencies can still be quite challenging.

When you find yourself stuck between wanting to install version 1.6 or 2.0 of a certain package but face difficulties, directly adding it to the json and updating might be a viable option.

In the early stages of development, it might be okay to use it without worrying too much, I suppose? I'm not sure, but in this case, since it's for web scraping purposes, I'll take it as no harm done.

Popular Articles

Deploying a PHP 7.4 + Laravel 6 Project to AWS EC2

Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!