Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top