Friday, February 18, 2022

[FIXED] Install RC1 version with composer for Drupal 8 module

Issue

I need to install a specific RC1 version for a Drupal 8 module with composer.

Example: https://www.drupal.org/project/field_group (8.x-3.0-rc1)

I've tried to use the constraint: '8.x-3.0-rc1'.

composer require drupal/field_group:8.x-3.0-rc1

The error message:

[UnexpectedValueException]
Could not parse version constraint 8.x-composer: Invalid version string "8.x-composer"

Solution

You can specify the version of the module / theme you want to download as follows:

composer require drupal/<modulename>:<version>

For example:

composer require 'drupal/token:^1.5'
composer require 'drupal/simple_fb_connect:~3.0'
composer require 'drupal/ctools:3.0.0-alpha26'
composer require 'drupal/field_group:3.0-rc1'
composer require 'drupal/token:1.x-dev'

To avoid problems on different terminals/shells, surround the version in quotes as in the examples above. In these examples, the versions map as follows:

  • ^1.5: maps to the latest stable 8.x-1.x release of the module.
  • ~3.0: maps to the latest stable 8.x-3.x release of the module.
  • 3.0.0-alpha26: maps to version 8.x-3.0-alpha26
  • 3.0-rc1: maps to version 8.x-3.0-rc1
  • 1.x-dev: maps to 8.x-1.x-dev

For more on version constraints with ~ (tilde) and ^ (caret) see Next Significant Release Operators.



Answered By - Kevin Wenger

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.