Problem/Motivation
Modules that require a specific version of another module, and that module is missing the version key in the info file, show a requirements error erroneously.
Steps to reproduce.
- Install linkit and linkit_media_library with composer.
- Since linkit.info is missing version key, a requirements error appears, even though the correct version is installed.
Original summary:
I getting these error when trying to update other modules through d8 gui.
Errors found
UNRESOLVED DEPENDENCY
Search API (Version >=8.x-1.2 required)
Solr search requires this module and version. Currently using Search API version
UNRESOLVED DEPENDENCY
Search API (Version >=8.x-1.2 required)
search_api_solr_multilingual requires this module and version. Currently using Search API version
UNRESOLVED DEPENDENCY
Search API (Version >=8.x-1.2 required)
Search api spellcheck requires this module and version. Currently using Search API version
All theses listed modules are DEV versions and installed via Composer.
"drupal/search_api": "1.x-dev",
"drupal/search_api_autocomplete": "1.x-dev",
"drupal/search_api_solr": "1.x-dev",
"drupal/search_api_solr_multilingual": "1.x-dev",
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | Screen Shot 2020-08-05 at 5.48.29 PM.png | 39.47 KB | lithiumlab |
| #21 | modules-form.png | 55.5 KB | oknate |
| #21 | status-report-page.png | 39.39 KB | oknate |
| #21 | 2890613-21.patch | 6.02 KB | oknate |
| #19 | 2890613-19.patch | 1.96 KB | oknate |
Comments
Comment #2
mkalkbrennerThe problem is that drupal core doesn't recognize "drupal/search_api": "1.x-dev" as newer then 8.x-1.2.
If you replace it by "drupal/search_api": "~1.2" it should work.
I think this is a core issue and I guess there's an existing issue for that. But I can't find it now. Therefore I move this issue to core.
Comment #3
mkalkbrennerComment #4
mkalkbrennerTry this: https://www.drupal.org/project/composer_deploy
Comment #5
cilefen commentedThis seems a duplicate of #2538090: Allow the Update Manager to automatically resolve Composer dependencies.
Comment #6
mkalkbrenner@cilefen: I disagree.
The problem is unrelated to composer. If git clone a module and try to install it, you run in this issue. Composer isn't involved here.
The git checkout has no version in info.yml.
Nevertheless as the latest version it should satisfy the dependency for >=8.x-1.2 declared in a different modules info.yml.
Comment #7
cilefen commentedYou specifically wrote "UI" in the issue summary so I was confused. So this is not the update module, or the install system, it's perhaps the extension system but I am still unsure as to what Drupal core has to do with this issue.
Please add steps to reproduce.
Comment #8
mkalkbrennerReproduce without composer:
Search API Solr Search is not installable via UI because of an unmet dpendency. But the latest git clone version of search_api should obiously resolve the depency.
drupal_check_incompatibility($v, $current_version) for search_api_solr gets these parameters for $v and $current_version:
Comment #9
mkalkbrennerhttps://www.drupal.org/project/composer_deploy solves the issue if you use composer to get a dev version. But it doesn't solve it for direct git clones, at least if they don't contain a composer.json.
Comment #10
rar9 commentedThanks https://www.drupal.org/project/composer_deploy worked for me.
My other site d8 test site didnt show this problem.
Comment #15
ressaI ran into a similar sounding warning updating from Search API Solr version 2.7 to 3.3. The only module I use dev-version of is Views data export, which has a test dependency on Search API, could that be why?
Anyway, I went ahead with the update, and everything seems to work fine. I am including it here in case anyone else ends up finding this issue, searching for words like "Unresolved dependency" and "Search API":
Comment #18
oknateI'm experiencing this when the module lacks a version.
linkit.info looks like this:
no "version" key. I installed it with composer.
So this means, it can't compare versions, and the you get a compatibility error.
Comment #19
oknateSteps to reproduce.
Comment #20
oknateComment #21
oknateI wrote one test, but I see this bug appears in two places /admin/modules and /admin/reports/status, and it turns out, the code is in two places, with the same bug, where if the version is missing in an info file (which I believe happens with dev versions of modules), it outputs a mangled error message.
Comment #22
oknateComment #23
chris burge commentedIf a dependency doesn't provide a version, then I think version requirement should not be enforced. The only times this should happen is 1) a project is hosted somewhere other than D.O. and simply doesn't declare a version and 2) a project that is Git cloned from D.O. In the first case, any requirement error is the fault of the requiring module. In the second case, there's no error. That's just a developer doing normal developer stuff.
In the case of *-dev versions, there's no easy way to determine if the dev release is new or older than the required version. Dev releases should be opted out, although we could check the major version (e.g. Module A requires >=8.x-5.x of Module B. 5.x-dev and 6.x-dev would pass, but 4.x-dev would not.)
Comment #24
lithiumlab commentedExperienced a very similar issue here while trying a drush updb or update.php procedure.
(Message in spanish)
Notice the following lines are very recent and generated by script it seems:
Information added by Drupal.org packaging script onin line 9
Looks like developer has missed declaring the version and this blocks updates.
It seems my local environment composer library repository is fetching the fresh one but in development environment is not.
Comment #25
chris burge commentedRe #24, it sounds like you're working with code from the project's Git repo and not from a packaged version of the module. The module version is added to the info.yml file by the Drupal.org packaging script. That said, you're still in the right place!
Comment #30
quietone commentedThis was a bugsmash random issue of the day and discussed with borisson_, dww, lendude, smustgrave, larowlan and myself.
The error message is no longer displayed because of #3239287: Fix \Drupal\Core\Extension\ModuleDependencyMessageTrait to not cause deprecations in PHP 8.1 which, when there is no version, sets the version to an empty string. When there is no version string the constraint is not checked, so no error message. That suggests this can be closed as outdated.
In order to have a module without a version property in the info.yml the module needs to be downloaded via git or use composer to get a dev version. Then if a dependent module requires a specific version, a check can not be made because the version string does not exist. The steps to reproduce in the Issue Summary needs to be updated to reflect that. Adding tag.
So, what to do here? borisson_ suggested that packaging script/composer facade could add a version. The dww chimed in, here is the quote from #bugsmash
Based on that, closing this as outdated and opening a new issue, a task, to add a better error message for this case.
Comment #31
quietone commentedMoved credit to the new issue, #3300838: Add informative message when module does not have a version property