composer install -n --ignore-platform-reqs not ignoring PHP extension
Asked Answered
O

2

8

we have circle build that runs composer install -n --ignore-platform-reqs --no-dev but this is not ignoring the platform requirements anymore.

This is what i see in the circle log. The --ignore-platform-reqs is clearly not working. Any ideas why please?

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for drupal/core 8.6.13 -> satisfiable by drupal/core[8.6.13].
    - drupal/core 8.6.13 requires ext-pdo * -> the requested PHP extension pdo is missing from your system.
  Problem 2
    - typo3/phar-stream-wrapper v2.1.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - typo3/phar-stream-wrapper v2.1.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - Installation request for typo3/phar-stream-wrapper v2.1.0 -> satisfiable by typo3/phar-stream-wrapper[v2.1.0].
Oren answered 29/3, 2019 at 22:35 Comment(0)
O
14

Instead of using --ignore-platform-reqs or provide hack it is better to mimic your environment using platform setting - it gives you more control about platform requirements and it is more intuitive than provide (your package does not really provide ext-fileinfo):

"config": {
    "platform": {
        "php": "7.2.14",
        "ext-fileinfo": "1.0.5",
        "ext-pdo": "7.2.14",
        "ext-session": "7.2.14",
        "ext-iconv": "7.2.14",
        "ext-zip": "1.15.4"
    }
},

Actual versions of extensions you may find by calling this command on production environment (although you could probably put anything for extensions version - it is quite uncommon to use anything except * as a constraint for PHP extensions):

composer show -p
Oswell answered 30/3, 2019 at 12:3 Comment(4)
I tried adding that in the platform but I got this error [UnexpectedValueException] Invalid version string "*"Oren
Thanks @rob . composer show -p helped. was able to get the right version for that. I do have one more suggestion that I need for composer.json file. I have a ` "minimum-stability": "dev", and "prefer-stable": true,` in my composer.json file but whenever I am trying to install a module for drupal using this command composer require 'drupal/file_mdm:^1.1' its downloading the dev version and not the stable version causing issues with my build. The dev version has .git folder in it and its creating issues with my repo. how do i force composer to download the stable version over dev?Oren
I'm not familiar with drupal and its repositories, but you may try --prefer-dist switch. Downloading package from source does not directly depends on its stability - you may use stable release and still have .git directory inside.Oswell
Thanks for the response. I tried using --prefer-dist but that didn't resolve it. will do more research. Thanks again.Oren
O
3

I am going to answer my own question just in case somebody stumbles here. Adding a provide with the list of extension in my composer.json file resolved the issue for me. This --ignore-platform-reqs had no effect.

 "provide": {
        "ext-fileinfo": "*",
        "ext-pdo": "*",
        "ext-session": "*",
        "ext-iconv": "*",
        "ext-zip": "*"
    }
Oren answered 30/3, 2019 at 0:1 Comment(2)
i would not recommend this, this way you will not see the errors on a live environment which does not have those. better add it to the global config in your home directory as stated in first solutionMistrot
Thanks for the suggestions. I took it out from provide and added it in my platform settings.Oren

© 2022 - 2024 — McMap. All rights reserved.