Problem/Motivation

Couldn't install 'rdfui' in Drupal 8.9.3. When the installation completes it throws an error.

Steps to reproduce

Proposed resolution

Fix composer.json file

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#3 3172502-composer.patch300 bytestomvanetten

Comments

SagaD created an issue. See original summary.

chodec’s picture

In my case composer throws this error (composer v1)

[RuntimeException]                                                                                                                                                                                              
  Could not load package drupal/rdfui in https://packages.drupal.org/8: [UnexpectedValueException] Could not parse version constraint ^1.0 as 0.9.1: Invalid version string "^1.0" in "^1.0 as 0.9.1", the alias  
   source must be an exact version, if it is a branch name you should prefix it with dev-
tomvanetten’s picture

Issue summary: View changes
StatusFileSize
new300 bytes
tomvanetten’s picture

Status: Active » Needs review

  • sanduhrs committed e94b577 on 8.x-1.x authored by tomvanetten
    Issue #3172502 by tomvanetten: Update composer requirements for easyrdf
    
sanduhrs’s picture

Status: Needs review » Fixed

Thanks for contributing!

mattbloomfield’s picture

It could just be me, but I'm trying to add rdfui to composer.json in 9.0.6 and 8.9.6 and I'm still getting the error. I've tried removing my dev requirement for easyrdf entirely, which removed it, but I'm still getting that error message.

elizoller’s picture

I am getting the same error in drupal 8.9.6

  [RuntimeException]
  Could not load package drupal/rdfui in https://packages.drupal.org/8: [UnexpectedValueException] Could not parse version constra
  int ^1.0 as 0.9.1: Invalid version string "^1.0" in "^1.0 as 0.9.1", the alias source must be an exact version, if it is a branc
  h name you should prefix it with dev-
Steven Brown’s picture

Status: Fixed » Needs work

The error still occurs in dev and in the 1.0-beta4 releases.

tomvanetten’s picture

Hi all,

Are you all at the commit : https://www.drupal.org/commitlog/commit/66863/e94b5776e3a017a84c9084c44e... or later locally (you have to require dev in composer, maybe remove it and then require the newest version)?
This only works if you are on that or a later version, the patch itself wont work as dependencies are installed earlier than the patch is applied. So there comes an error from. Maybe there are more erros, but this patch solves one of them (at least for the latest drupal 8.8 release)

I did not have time to fix it in beta releases or other branches other than dev. Please feel free to apply the patch to those branches and raise issues! Then the maintainer can apply them quickly there.

tomvanetten’s picture

Status: Needs work » Closed (outdated)
mchamps’s picture

Hi, I'm running Drupal 8.9.13.
When I run composer require drupal/rdfui , it installs automatically drupal/rdfui (1.0.0-beta3)
So I run composer require drupal/rdfui ^1.0.0-beta4 and I get the following error :
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: don't install drupal/rdfui 1.0.0-beta4
- Conclusion: remove easyrdf/easyrdf 0.9.1
- Installation request for drupal/rdfui ^1.0.0-beta4 -> satisfiable by drupal/rdfui[1.x-dev, 1.0.0-beta4].
- Conclusion: don't install easyrdf/easyrdf 0.9.1
- drupal/rdfui 1.x-dev requires easyrdf/easyrdf ^1.0 -> satisfiable by easyrdf/easyrdf[1.0.0, 1.0.0-rc.1, 1.1.0, 1.1.1].
- Can only install one of: easyrdf/easyrdf[1.0.0, 0.9.1].
- Can only install one of: easyrdf/easyrdf[1.0.0-rc.1, 0.9.1].
- Can only install one of: easyrdf/easyrdf[1.1.0, 0.9.1].
- Can only install one of: easyrdf/easyrdf[1.1.1, 0.9.1].
- Installation request for easyrdf/easyrdf (locked at 0.9.1) -> satisfiable by easyrdf/easyrdf[0.9.1].

Installation failed, reverting ./composer.json to its original content.

With beta3, It throws an error when I enable the RDF UI module.

Cheers

aaronelborg’s picture

@mchamps Were you able to resolve this? I'm in the same boat using 8.9.14.

mmjvb’s picture

Should be very easy to solve with --update-with-dependencies on the require.

When you require a module you need to make sure dependencies are allowed to be updated when needed. Prefer to do the right thing up front, but when lazy feel free to be surprised.

Doing the right things up front would be using several require --no-update followed by a whitelisted update:
composer require drupal/rdfui ^1.0@beta --no-update
composer require easyrdf/easyrdf ^1.0 --no-update
composer update drupal/rdfui easyrdf/easyrdf

Note: easyrdf/easyrdf may not need to become a primary requirement. So, you may omit that require and just use the other two commands. It is not clear from the information provided above whether there is a requirement constraint blocking 1.x.

owens-d’s picture

I just managed to install this on my Drupal 8.9.15 version by aliasing easyrdf 1.1.1 to easyrdf 0.9.1 in composer.json.
using the following command: composer require easyrdf/easyrdf:"1.1.1 as 0.9.1"

I could subsequently install drupal/rdfui ^1.0@beta : composer require drupal/rdfui ^1.0@beta
and enable it in the extend page without issue, and RDFUI appears to work as intended.

It is a quick and dirty solution but it works for D8.9 until the rest of my project can be updated to D9.x

aaronelborg’s picture

Thanks, Owens-D. That seems to have worked!

mchamps’s picture

Thanks mmjvb & Owens-D for your help.

I'm getting the following errors. With mmjvb's solution :

$ composer require drupal/rdfui ^1.0@beta --no-update
./composer.json has been updated
$ composer require easyrdf/easyrdf ^1.0 --no-update
./composer.json has been updated
$ composer update drupal/rdfui easyrdf/easyrdf
Gathering patches for root package.
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies                                 
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - drupal/core is locked to version 8.9.16 and an update of this package was not requested.
    - drupal/core 8.9.16 requires easyrdf/easyrdf ^0.9 -> found easyrdf/easyrdf[0.9.0-rc.1, ..., 0.9.x-dev] but it conflicts with your root composer.json require (^1.0).
  Problem 2
    - drupal/core 8.9.16 requires easyrdf/easyrdf ^0.9 -> found easyrdf/easyrdf[0.9.0-rc.1, ..., 0.9.x-dev] but it conflicts with your root composer.json require (^1.0).
    - drupal/yoast_seo 1.7.0 requires drupal/core ^8 || ^9 -> satisfiable by drupal/core[8.9.16].
    - drupal/yoast_seo is locked to version 1.7.0 and an update of this package was not requested.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

With Owens-D quick & dirty solution :

$ composer2 require easyrdf/easyrdf:"1.1.1 as 0.9.1"

  [InvalidArgumentException]  
  Could not find package as.  
                              
  Did you mean one of these?  
      ext-hash                
      npm-asset/6             
      npm-asset/p             
      npm-asset/2             
      npm-asset/1             

Thanks everybody!

mmjvb’s picture

It is not clear from the information provided above whether there is a requirement constraint blocking 1.x.

Now, it is!

Obviously, the first step would have been:
composer prohibits easyrdf/easyrdf 1.1.1
Giving you drupal/core requiring esyrdf/easyrdf ^0.9 which excludes ^1.1.

Unfortunately, that is for all drupal/core 8.9. That means you need to migrate to D9.
Or use the suggestion to have 1.1.1 pretend to be 0.9.9 so the constraint from core is fulfilled. See answer Owens-D #15

docker@cli:/var/www$ composer require easyrdf/easyrdf "1.1.1 as 0.9.9"
./composer.json has been updated
Running composer update easyrdf/easyrdf
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading easyrdf/easyrdf (0.9.1 => 1.1.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Downloading easyrdf/easyrdf (1.1.1)
  - Upgrading easyrdf/easyrdf (0.9.1 => 1.1.1): Extracting archive
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Generating autoload files
48 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
docker@cli:/var/www$

Notice the lack of : between package and constraint.

mchamps’s picture

Sorry mmjvb, I couldn't get it to work.

I migrate to Drupal 9.2 and it now works great ! Thanks all for your help !