1

I'm trying to install a module on Github through

 composer require postcode-nl/api-magento2-module

However, the installation is failing with this error:

Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - feedbackcompany/module-reviews 1.0.0 requires php ~7.1.3||~7.2.0||~7.3.0 -> your PHP version (7.4.18) does not satisfy that requirement.
    - feedbackcompany/module-reviews 1.0.0 requires php ~7.1.3||~7.2.0||~7.3.0 -> your PHP version (7.4.18) does not satisfy that requirement.
    - feedbackcompany/module-reviews 1.0.0 requires php ~7.1.3||~7.2.0||~7.3.0 -> your PHP version (7.4.18) does not satisfy that requirement.
    - Installation request for feedbackcompany/module-reviews ^1.0 -> satisfiable by feedbackcompany/module-reviews[1.0.0].

My situation: I have recently moved my Magento 2 installation to a new hosting environment. The previous environment had PHP 7.3, current environment PHP 7.4.

Is there a way to get around this without having to downgrade my PHP version? Removing the module mentioned in the error is not really an option as well. Besides, the module in the error works just fine on 7.4.

1

Try to use --ignore-platform-reqs composer option.

--ignore-platform-reqs: ignore all platform requirements (php, hhvm, lib-* and ext-*) and force the installation even if the local machine does not fulfill these. See also the platform config option.

Source.

If you wish to ignore just the php version and you are using the Composer 2 you can use specific ignore rule:

--ignore-platform-req php
1
  • 1
    Exactly what I was looking for, thank you!
    – Jason
    May 7 '21 at 8:47
-1

In your new hosting environment you can force change the PHP version 7.4 to 7.3, you can take the help of the people/company from where you purchased the new hosting environment.
Cpanel steps to change the php version -
Adjusting PHP Version within cPanel

  1. Login to your hosting cPanel.
  2. Locate the MultiPHP Manager tool in the Software section of your cPanel.
  3. Click the checkbox for the domain(s) that you want to adjust.
  4. From the drop-down menu labeled PHP version, select the PHP version that best suits your site code.
  5. Click the blue Apply button to save the change.
    enter image description here
1
  • I don't want to downgrade my complete PHP version for just this module. The official Magento 2 requirements state I should use PHP 7.4 for my Magento version (> 2.4.1). Not to forget: the module in the error works just fine on PHP 7.4, its requirements simply aren't right / up to date causing composer to break.
    – Jason
    May 7 '21 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.