6

Now, a good amount of modules do not yet have a stable version, for example, webform. composer require drupal/webform says:

Could not find package drupal/webform at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability

If I try composer require --minimum-stability=beta drupal/webform, I get:

The "--minimum-stability" option does not exist.

drush dl gives:

This codebase is assembled with Composer instead of Drush. Use composer update and composer require instead of drush pm-updatecode and drush pm-download.

Note that due to the special versioning of Drupal this is not a generic composer question but a Drupal specific one. Ie. webform today is 8.x-5.0-beta12, how do I install the latest in the 8.x-5.0 series...? Now, composer doesn't understand or use 8.x-5.0 but uses somethting else, but what and how does that work for betas? This needs documentation somewhere because it currently does not exist. I would be the happiest person if this didn't need an answer, but alas, despite having perfectly fine working tools to build sites, with Drupal 8 we need to use composer and most modules are in beta.

0
14

This installs the latest beta-12 for me:

composer require drupal/webform:5.0.*@dev

You need to do a bit of translation from the Drupal version number. From Using Composer to manage Drupal site dependencies:

Specifying a version you can specify a version from the command line with:

 $ composer require drupal/<modulename>:<version> 

For example:

 $ composer require drupal/ctools:3.0.0-alpha26
 $ composer require drupal/token:1.x-dev 

In these examples, the composer version 3.0.0-alpha26 maps to the drupal.org version 8.x-3.0-alpha26 and 1.x-dev maps to 8.x-1.x branch on drupal.org.

If you specify a branch, such as 1.x you must add -dev to the end of the version.

Hence for Webform, 8.5 becomes 5.0.x, and that's what you need to use to identify the package correctly.

3
  • This doesn't work. composer require 'drupal/bricks:2.0.*@dev' goes Downgrading drupal/bricks (2.0.2-beta1 => 2.0.1) , I just released 2.0.2-beta2. Sep 24 at 8:47
  • Works fine for me and plenty of others, check the rest of your configuration
    – Clive
    Sep 24 at 9:33
1

The reason this doesn't work because the "stable preference" of composer is not a preference but a hard choice which you can not override with anything except specifying an exact version.

If you have "prefer-stable": true, in your composer.json then the only way to install a beta module is composer require 'drupal/bricks:2.0.2-beta2'. Neither 2.0.*@dev nor anything else will work except that.

Switching that setting off with composer config prefer-stable false is possible but it might affect other modules.

You can check why composer refuses to do what you tell it to do -- because of course it does -- with composer why-not drupal/bricks:2.0.2-beta2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.