The Currency module requires Composer dependencies. I am trying to install it with the following command:

composer.phar require drupal/currency

It returns the following error.

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

What am I doing wrong?

Furthermore, if I specify the version of currency with composer.phar require drupal/currency:8.x-3.1, I get this error:

Could not parse version constraint 8.x-3.1: Invalid version string "8.x-3.1"

Anything is going wrong and I don't know what. The file composer.json and composer.phar are both in root directory of the Drupal installation.

  • Do you have composer.json file in the folder in which you are running composer command?
    – sorabh.v6
    Aug 14, 2017 at 8:35
  • I just ran the same command and it downloaded currency module. Do you have updated composer installation?
    – sorabh.v6
    Aug 14, 2017 at 9:11
  • As side note, the composer.phar file should be in a directory where the shell you are using looks for commands, not in the root directory of Drupal.
    – apaderno
    Aug 14, 2017 at 10:52

3 Answers 3


composer require drupal/currency:^3.0 should do it.

This will download the latest 3.x release version from Drupal.org. You don't specify the 8.x-3.1 in the version tag here, which is a confusing gotcha for people first starting with Composer. Composer already knows you are searching the 8.x releases because of the endpoint specified /8.

I suggest installing Composer also via https://getcomposer.org/doc/00-intro.md#globally instead of have the .phar in the Drupal project root.

As long as your root composer.json lists the Drupal packages endpoint, this command should work. If not, something else is wrong.


The error message could make you think there isn't any stable release of the module, but since there is a 8.x-3.1 version, that is not the case.

The possible causes are:

  • composer.phar require drupal/currency is not executed from the directory containing the composer.json file you are using, or the one Drupal comes with
  • The composer.json file doesn't list as repository the one having drupal/currency as package
  • The repository listed from the composer.json file as the one containing the drupal/currency package is the wrong one
  • The composer.json file is referring, in the repositories section, a server that is not anymore active, or where the packagist service has been disabled

Keep in mind that Composer, by default, looks at the packages in https://packagist.org. That is why the composer.json file that comes with Drupal 8.4 contains the following lines.

"repositories": [
        "type": "composer",
        "url": "https://packages.drupal.org/8"

If you were using https://packages.drupal.org/7 for Drupal 8, you would get the wrong modules. If you are using https://packagist.drupal-composer.org, that repository is not anymore working.

Keep also in mind that, if you were previously using https://packagist.drupal-composer.org, and you passed to https://packages.drupal.org/8, the package versions need to be accordingly changed; for example, using https://packages.drupal.org/8, composer require honeypot:1.27 is requiring version 8.x-1.27 of the Honeypot module.

  • Thanks for reply! In composer.json the URL is set right to „packages.drupal.org/8“. And i use a new clean Drupal installation via composer.
    – Da.
    Aug 14, 2017 at 10:37
  • See the example I used in the answer. 8.x-3.1 is not a valid version, for packages.drupal.org/8; you need to use 3.1, or other restrictions that allow you to use also future versions.
    – apaderno
    Aug 14, 2017 at 10:48
  • Thanks, i have try this, but getting also following error: Problem 1 - The requested package drupal/currency 3.1 exists as drupal/currency[2555877.x-dev, 2556477.x-dev, 2670238.x-dev, dev-7.x-2.x, dev-8.x-3.x, dev-currency-exchange] but these are rejected by your constraint. I do not know what is going wrong.
    – Da.
    Aug 14, 2017 at 11:19
  • I have try every restriction (3.1, 3.x, 3.x-dev,...), nothing works. I always get the same error. Do you have any other ideas please?
    – Da.
    Aug 14, 2017 at 11:43

If you're getting an error like this the first time you use composer:

Could not find a version of package drupal/some_project matching your minimum-stability (dev). Require it with an explicit version constraint allowing its desired stability.

...but there is definitely some version available that meets the criteria, and you get the same error on a well known project (e.g. composer require drupal/views), it's very likely the composer.json has a missing or out of date repository.

The docs on how to assign the correct repository should be in https://www.drupal.org/docs/develop/using-composer/using-composer-to-manage-drupal-site-dependencies but they are quite hard to find on that page, currently under the subheading "Define Drupal.org as Composer repository if needed" at the end of the long section "Download Drupal core using Composer", which you might skip if you already have Drupal core downloaded and installed (e.g. if you use DrupalVM).

The necessary step is currently (August 2018) to run this command before using composer require for the first time. If it doesn't work, the repository location might have changed, so hunt for the appropriate section on the above-linked docs page:

composer config repositories.drupal composer https://packages.drupal.org/8

(substitute 7 for the 8 at the end if you're using Drupal 7)

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .