I'm trying to create and configure a Drupal 8.x website and I'm finding that contributed modules and or their functionality are hit-and-miss... This isn't unexpected but from a Drupal Org standpoint, what I wasn't prepared for is seeing on every module download page inadequate Composer instructions meant to help developers download and install respective modules. After all, Composer is supposed to make everything easier to maintain, right? If so, why are the "composer require" commands listed on the module download pages also hit-and-miss?

The error in Composer that I see when the "composer require" instructions listed on the module download pages fails, is as follows:

[InvalidArgumentException]
Could not find package drupal/X in a version matching N

I'm not sure what this means exactly other than to assume that the module maintainer or developers haven't used a Drupal repository... Is that correct? If so, is there a standard procedure one must use to figure out what the correct repository is? If module maintainers or developers want nothing to do with using Composer, then why are those instructions on their module download pages?

Any insight into this would be appreciated.

Comments

Wolf_22 created an issue. See original summary.

cilefen’s picture

It is virtually impossible to provide assistance without seeing the composer.json file. Please post it. We will also require the precise command that fails, and a reference to which module this is.

wolf_22’s picture

@cilefen, sure thing.

Here's my composer.json file:

    {
        "name": "drupal/recommended-project",
        "description": "Project template for Drupal 8 projects with a relocated document root",
        "type": "project",
        "license": "GPL-2.0-or-later",
        "homepage": "https://www.drupal.org/project/drupal",
        "support": {
            "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
            "chat": "https://www.drupal.org/node/314178"
        },
        "repositories": [
            {
                "type": "composer",
                "url": "https://packages.drupal.org/8"
            }
        ],
        "require": {
            "composer/installers": "^1.2",
            "drupal/address": "1.8",
            "drupal/admin_toolbar": "2.2",
            "drupal/antibot": "1.3",
            "drupal/autoban": "1.6",
            "drupal/backup_migrate": "4.1",
            "drupal/captcha": "1.0",
            "drupal/chosen": "2.9",
            "drupal/commerce": "2.17",
            "drupal/config_split": "1.4",
            "drupal/core-composer-scaffold": "^8.8",
            "drupal/core-project-message": "^8.8",
            "drupal/core-recommended": "^8.8",
            "drupal/date_popup": "1.0",
            "drupal/date_range_formatter": "3.1",
            "drupal/devel": "2.1",
            "drupal/geshifilter": "1.3",
            "drupal/ip2country": "1.9",
            "drupal/restrict_ip": "1.3",
            "drupal/webform": "5.13"
        },
        "conflict": {
            "drupal/drupal": "*"
        },
        "minimum-stability": "dev",
        "prefer-stable": true,
        "config": {
            "sort-packages": true
        },
        "extra": {
            "drupal-scaffold": {
                "locations": {
                    "web-root": "../public_html/blah_website/"
                }
            },
            "installer-paths": {
                "../public_html/blah_website/core": [
                    "type:drupal-core"
                ],
                "../public_html/blah_website/libraries/{$name}": [
                    "type:drupal-library"
                ],
                "../public_html/blah_website/modules/contrib/{$name}": [
                    "type:drupal-module"
                ],
                "../public_html/blah_website/profiles/contrib/{$name}": [
                    "type:drupal-profile"
                ],
                "../public_html/blah_website/themes/contrib/{$name}": [
                    "type:drupal-theme"
                ],
                "drush/Commands/contrib/{$name}": [
                    "type:drupal-drush"
                ],
                "../public_html/blah_website/modules/custom/{$name}": [
                    "type:drupal-custom-module"
                ],
                "../public_html/blah_website/themes/custom/{$name}": [
                    "type:drupal-custom-theme"
                ]
            },
            "drupal-core-project-message": {
                "include-keys": [
                    "homepage",
                    "support"
                ],
                "post-create-project-cmd-message": [
                    "<bg=blue;fg=white>                                                         </>",
                    "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                    "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                    "<bg=blue;fg=white>                                                         </>",
                    "",
                    "<bg=yellow;fg=black>Next steps</>:",
                    "  * Install the site: https://www.drupal.org/docs/8/install",
                    "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                    "  * Get support: https://www.drupal.org/support",
                    "  * Get involved with the Drupal community:",
                    "      https://www.drupal.org/getting-involved",
                    "  * Remove the plugin that prints this message:",
                    "      composer remove drupal/core-project-message"
                ]
            }
        }
    }

The requires listed above worked perfectly fine but as an example, 2 contributed modules I tried to install without any luck are the v8 alpha versions of "commerce_license" and "acl". The commands I tried to use are those listed on each of those pages I linked to $ composer require drupal/commerce_license:^2.0 and $ composer require drupal/acl:^1.0. Both commands result in the aforementioned error above...

Is this just a case of needing to add an additional repository into my composer.json file? If so, what's the standard method of determining what that additional repository entry is besides posting in each contributor's issue queue? Seems reasonable to think that if the "composer create-project --no-install..." command created the initial composer.json file, that it would have the respective repository(ies) necessary for any Drupal developer to need, especially if contributor module pages are listing generic "composer require" instructions for people to use without specific information necessary to correct deficient commands.

There were other modules that this situation has happened with, but another thing I'm seeing is how sometimes the commands work only until during the execution of the install command we're prompted for authentication details with nothing on the module download pages nor instructions indicating what these are. I understand why someone wants or needs a gated repository but to post on a module download page instructions for using Composer to download a module without first providing insights into understanding that the respective version in question exists within a gated repository, seems odd or counterproductive to how Drupal has always provided open access to those modules found from contributor download pages.

(I'm sure I'm either just misunderstanding or overlooking something here, so any insight into this would be appreciated and apologies in advance for any headaches.)

cilefen’s picture

I can't reproduce the bug you are reporting.

I created the composer.json as above, then:

$ composer install
...
$ composer require drupal/acl:^1.0
...
$ composer show drupal/acl
name     : drupal/acl
descrip. : Access control list API. Has no features on its own.
keywords :
versions : * 1.0.0-alpha2
type     : drupal-module
license  : GNU General Public License v2.0 or later (GPL-2.0-or-later) (OSI approved) https://spdx.org/licenses/GPL-2.0-or-later.html#licenseText
homepage : https://www.drupal.org/project/acl
source   : [git] https://git.drupalcode.org/project/acl.git 8.x-1.0-alpha2
dist     : [zip] https://ftp.drupal.org/files/projects/acl-8.x-1.0-alpha2.zip 8.x-1.0-alpha2
path     : /Users/cjm/Downloads/public_html/blah_website/modules/contrib/acl
names    : drupal/acl

support
source : https://git.drupalcode.org/project/acl

requires
drupal/core ~8.0
Is this just a case of needing to add an additional repository into my composer.json file?

No. The correct and only needed repository is set.

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

I am curious as to the version of Composer.

$ composer --version
Composer version 1.10.6 2020-05-06 10:28:10
wolf_22’s picture

It looks like I have the following:

$ composer --version
Composer version 1.9.1 2019-11-01 17:20:17

So I updated it...

$ composer self-update
Updating to version 1.10.6 (stable channel).
   Downloading (100%)
Use composer self-update --rollback to return to version 1.9.1

To verify the new version, I checked it again:

$ composer --version
Composer version 1.10.6 2020-05-06 10:28:10

And even after using a new CMD window with this newest version, I still see the error when trying to download ACL:

composer require drupal/acl:^1.0

...which results in...

[InvalidArgumentException]
Could not find package drupal/acl in a version matching 1.0

Any other ideas? I'm at a loss.

cilefen’s picture

Have you executed Composer in verbose mode (-vvv)?

cilefen’s picture

Also composer clear-cache.

wolf_22’s picture

Just tried that. Here's how it went (ultimately ended in the same outcome but I hope you can see something from everything I logged below):

1.) Executed --version:
Composer version 1.10.6 2020-05-06 10:28:10

2.) Executed clear-cache:

Cache directory does not exist (cache-vcs-dir): 
Clearing cache (cache-repo-dir): X:\www\__composer\cache\repo
Clearing cache (cache-files-dir): X:\www\__composer\cache\files
Clearing cache (cache-dir): X:\www\__composer\cache
All caches cleared.

3.) Executed require acl with -vvv:

Reading ./composer.json
Loading config file ./composer.json
Checked CA file C:\Users\wolf_22\AppData\Local\Temp\ope8AEE.tmp: valid
Executing command (X:\www\projects\blah_d8_composer\blah_sandbox_composer): git branch --no-color --no-abbrev -v
Executing command (X:\www\projects\blah_d8_composer\blah_sandbox_composer): git describe --exact-match --tags
Executing command (X:\www\projects\blah_d8_composer\blah_sandbox_composer): git log --pretty="%H" -n1 HEAD
Executing command (X:\www\projects\blah_d8_composer\blah_sandbox_composer): hg branch
Executing command (X:\www\projects\blah_d8_composer\blah_sandbox_composer): fossil branch list
Executing command (X:\www\projects\blah_d8_composer\blah_sandbox_composer): fossil tag list
Executing command (X:\www\projects\blah_d8_composer\blah_sandbox_composer): svn info --xml
Reading X:\www\__composer/composer.json
Loading config file X:\www\__composer/composer.json
Reading X:\www\projects\blah_d8_composer\blah_sandbox_composer/vendor/composer/installed.json
Reading X:\www\__composer/vendor/composer/installed.json
Loading plugin Drupal\Composer\Plugin\ProjectMessage\MessagePlugin
Loading plugin Drupal\Composer\Plugin\Scaffold\Plugin
Loading plugin Composer\Installers\Plugin
Running 1.10.6 (2020-05-06 10:28:10) with PHP 7.3.12 on Windows NT / 10.0
Downloading https://packages.drupal.org/8/packages.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/packages.json into cache
Downloading https://repo.packagist.org/packages.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/packages.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2020-2%24489a7e6d74029c9b501b14bd0302e735e01b60d3dcedf683bc829bd8643917c5.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2020-2.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2020-1%24c12988a0a75856efabd53ff54939f009d9c6627cbb412cee5fc272f91deb1625.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2020-1.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2019-4%24c895ed597cfab12260451d8f4ccd1fb99c66003b586a208951d4da9906dc9513.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2019-4.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2019-3%24347a90eb8f086f02f669655c25a0cd05d9f28c5bffa6172a83fa1d315c5e8be8.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2019-3.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2019-2%24d240ed286a5fd83d7348ef99a69d66def5a2bbf7e6186581bdad11ea0232765c.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2019-2.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2019-1%2404a753a98f7830de3fbea121439646ce37eb3a8456eaf2472b76921b46b35ac0.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2019-1.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2018-4%241e59a6c86a5a05aa1cb4de10bfe447a67203d1259378a3073d4098461c493ed1.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2018-4.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2018-3%244ed4b279320e650cb2522a5e20a940767452a52818786367e23c3a824d11d8a3.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2018-3.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2018-2%2424c6ba374aa97d97823691b467f8ebc738459bedd52d6f281fc294b04b75fc1c.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2018-2.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2018-1%244c096cbecca1d633542e13db3e0c1d39eda0652e4e72642072ac5de12ea88d9a.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2018-1.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2017-4%24c3498800b002f256dd02f21c2f4fcb0b8aa01abbd572132e9d766c9e129a34d4.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2017-4.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2017-3%243b9d202f37a91bc9fc30e3fb3daf60afb9f1a8ff0344092e5c419ec7a39fdd4f.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2017-3.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2017-2%2487d8a19beaf77aeb2ebf1c8be43426f2737df0092ad02c46c5bb1ee7be2cfbe6.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2017-2.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2017-1%24bf40ae7dea17e793e6317be1337de70b381185791ecd4c3b8efffc759271f9e8.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2017-1.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2016-4%24d1e39b502f8a618c4fa44b26ee595b702b0da2f43eba22a656cc1adde0d0d716.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2016-4.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2016-3%242a507d52ff9075aaa220790bc47c7d145f72b38d1ad8473feca37d48a678a178.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2016-3.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2016-2%24657b4e0199e02a65d3d6243d9403beb5d157c68b407b783c9061b3dac19aa64f.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2016-2.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2016-1%2481eb6550cd83f95e428410d35d65dba5f7d6ca0b55d2da40969c8eb29af21b5c.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2016-1.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2015-4%2479d52ac9d5b32c88876b6396749d18c6ec5c14027d2129af447a36e8717558c5.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2015-4.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2015-3%249715ba742325a760bcfe2e09626dad967edb699110b955011b6f6a036e86a0f3.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2015-3.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2015-2%2452ee884d650d203944e2455debb85fdc114ef5b54605c64c4c14b89692bf2709.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2015-2.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2015-1%24aed90e5c241f56f02e3680cf3e53715046e036cae3762b15a3b70780805260c8.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2015-1.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2014-4%243256925853b592455d7b0bcbf39d94edd1f616ec086a49f9ca62786128fc42bb.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2014-4.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2014-3%245e360bc28a44c89395ce64a1b66a348e328e1e5eae85cbade2cc3f3b5436972f.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2014-3.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2014-2%24fb50d3241e589d4f2f3dfe31c9a07b057dd0ed5cf79d4adb9072599965b807be.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2014-2.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2014-1%246d076729fac75538a330aba1d02010878a8e51b6a2e6e4c0026ae073cb9a142a.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2014-1.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2013-4%2467944b8fcfd9d8606f1171fe0b9c86657102186891333ee14644d7b27c867a3b.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2013-4.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2013-3%243a3fd66e14bc4dee8c0a0d3dfde57282ede30ceda511638ca884834707d5b9c7.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2013-3.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2013-2%243ffcc0e10eaf193c5266ca656d7d8bd65bf4f3848739984a0eed8a1a9a8dd9fe.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2013-2.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2013-1%248660798c7e5dc0345e155d78393063a50a08395049f3c231e4d68e184ea94046.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2013-1.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2012-4%248ed87d149f7d03e0f573b057d7861bfda08bb7e821d9af2e57e74225b83c5811.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2012-4.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2012-3%24a4a4d7c2a00f0d57ff366cb3a9b7d6c77f0973444b29efb33c4a1143fbb51782.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2012-3.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2012-2%24738698cf1cabe4e8baa286456d3fb19f74c7e1b6a0a6b5ad0cb580cb7ef84acd.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2012-2.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2012-1%240f0d65f657c70ebe5888c5342309ecc66388859b933d857174cd4068d0cddb60.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2012-1.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2011-4%2438abf56cd4c38dbc738888af55c7b526f58623a666674f99ef4bd32dba0ec224.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2011-4.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2011-3%243477d1421ccd28712bd38a4ec548d189704581e67ebc2a121d38b1e9fce2ee6d.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2011-3.json into cache
Downloading https://packages.drupal.org/8/drupal/provider-2011-2%24c792f34f8f2ed456b1fe94aa274227398f3a44570ff0a7bfd8e82309e62a7458.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/drupal-provider-2011-2.json into cache
Downloading https://packages.drupal.org/8/drupal/acl%246cdb4e9f56a9e388aba53ca51c13220de61f01e34b7bc1b468e875802d5c6c9b.json
Writing X:\www\__composer/cache/repo/https---packages.drupal.org-8/provider-drupal$acl.json into cache
Downloading http://repo.packagist.org/p/provider-2013%2439889488e431198f82366f24d4b180f004da7736a9d8f247d692e2f180d2dbb5.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2013.json into cache
Downloading http://repo.packagist.org/p/provider-2014%24f531fb62fcdcfcbcd019cb7df7e5f2fb4fe860952bac14327cf0da803cffdf47.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2014.json into cache
Downloading http://repo.packagist.org/p/provider-2015%248e4fdca7fe3200a44decf2957ed0d16cdba0a91ac0a04b0776abb3bbe66babba.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2015.json into cache
Downloading http://repo.packagist.org/p/provider-2016%24aaba1d4fdc0a646f1bb4a9e0d6b924d747fc22485bfa4ed4c919050de3ec6413.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2016.json into cache
Downloading http://repo.packagist.org/p/provider-2017%24a37bcaf7aa1681386f75e2e3c3413a0ca1c7a0c6f68a32b65b72a2830f1b66c6.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2017.json into cache
Downloading http://repo.packagist.org/p/provider-2018%244dd2eed5e9e839c730ec78f5d756ea8d089570c535d4d51cc45c0ab5aaddcf8d.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2018.json into cache
Downloading http://repo.packagist.org/p/provider-2019%2494989e1119d9dee0a1f93209d99b810ecee000de71c98ca704ecb62c106e328f.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2019.json into cache
Downloading http://repo.packagist.org/p/provider-2019-07%241d54b78fcf6d203d6d1f3eb2ad2ed296662dc9efb62ce5266726c693c569f1a8.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2019-07.json into cache
Downloading http://repo.packagist.org/p/provider-2019-10%24e0c64639aeafdc275fc21e63d0dcdc81d8785a19d0f34ef7133faf1732084e98.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2019-10.json into cache
Downloading http://repo.packagist.org/p/provider-2020-01%2425bd99fdf1cddb79065563b3d787aaf6ac8376efa065a9ea86da9788c3ba6066.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2020-01.json into cache
Downloading http://repo.packagist.org/p/provider-2020-04%24f3f83995e1a7da4077badb5d5a67dcb4b72297cda42ed645b4e7cf472cec4b2a.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-2020-04.json into cache
Downloading http://repo.packagist.org/p/provider-archived%24beea589ae8fd6b04caf1c0ee549f49ae1202aefefc93f9a94e63092dd7ed6d3b.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-archived.json into cache
Downloading http://repo.packagist.org/p/provider-latest%24390c5a521381332fc8bc35e6f8a73f1ebc8b362c4478c9c3db54e81f113b6c14.json
Writing X:\www\__composer/cache/repo/https---repo.packagist.org/p-provider-latest.json into cache

                                                               
  [InvalidArgumentException]                                   
  Could not find package drupal/acl in a version matching 1.0  
                                                               

Exception trace:
 () at phar://X:/www/__composer/composer.phar/src/Composer/Command/InitCommand.php:765
 Composer\Command\InitCommand->findBestVersionAndNameForPackage() at phar://X:/www/__composer/composer.phar/src/Composer/Command/InitCommand.php:429
 Composer\Command\InitCommand->determineRequirements() at phar://X:/www/__composer/composer.phar/src/Composer/Command/RequireCommand.php:163
 Composer\Command\RequireCommand->execute() at phar://X:/www/__composer/composer.phar/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar://X:/www/__composer/composer.phar/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar://X:/www/__composer/composer.phar/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar://X:/www/__composer/composer.phar/src/Composer/Console/Application.php:281
 Composer\Console\Application->doRun() at phar://X:/www/__composer/composer.phar/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar://X:/www/__composer/composer.phar/src/Composer/Console/Application.php:113
 Composer\Console\Application->run() at phar://X:/www/__composer/composer.phar/bin/composer:61
 require() at X:\www\__composer\composer.phar:24

require [--dev] [--prefer-source] [--prefer-dist] [--fixed] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

Seems like it gets to the writing of p-provider-latest.json into cache before the invalid argument ending / exception trace...

longwave’s picture

Is the ^ being ignored for some reason? It's not present in your error message:

$ composer require drupal/acl:1.0
                                                               
  [InvalidArgumentException]                                   
  Could not find package drupal/acl in a version matching 1.0  
$ composer require drupal/acl:^1.0
./composer.json has been updated
> Drupal\Composer\Composer::ensureComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
...
$ composer require drupal/acl:^2.0
                                                               
  [InvalidArgumentException]                                   
  Could not find package drupal/acl in a version matching ^2.0  

Note that when I ask for ^2.0 it's shown in the error; in your example it is not shown, which makes me think Composer is looking for the exact version "1.0" - which doesn't exist.

longwave’s picture

On Windows it seems the caret is ignored, sometimes: https://github.com/composer/composer/issues/5151

wolf_22’s picture

Nice eyes, longwave...but on that github thread you linked to, it sounds like it's only an issue for a 64-bit Windows 7 architecture (and not a Windows 10 system like the one I was trying all this from). I could be wrong...

In any event, I'll try to poke a stick at different command formats to see if it helps any, such as quoting things or using the double-caret approach like one of the commenters claimed to have worked. Out of curiosity, how does one learn what versions are available for someone to use in their Composer command? Because I just looked at their repository but I'm not sure what constitutes a version that can be used in Composer unless the standard practice is that you just imply for Composer that you want a version higher than X via things like tildes or carets, etc...all I see are more human-readable version identifiers, such as "8.x-1.0-alpha2." Does each Git repo have an explicit page somewhere that divulges this kind of information?

cilefen’s picture

composer show -a package/name

https://getcomposer.org/doc/03-cli.md#show

wolf_22’s picture

Thanks for the command, cilefen.

So I finally managed to get everything downloaded... I used the quadruple caret approach as follows:

composer require drupal/acl:^^^^1.0

Using the same approach, I also managed to get the current content_access downloaded this way, too:

composer require drupal/content_access:^^^^1.0

Everything is showing up as expected in the composer.json file, the module(s) have been downloaded, and I'm seeing interfaces in my Drupal installation after installing both... Totally nuts but I'm happy it's working now.

Thanks you two!

longwave’s picture

Status: Active » Fixed

Glad you were able to resolve it, thanks for following up with the fix as it will help others if they have the same issue.

cilefen’s picture

Title: Could not find package drupal/X in a version matching N... » "Could not find package drupal/X in a version" matching when using Composer on Windows with a "^" int he version constraint
cilefen’s picture

Title: "Could not find package drupal/X in a version" matching when using Composer on Windows with a "^" int he version constraint » "Could not find package drupal/X in a version" matching when using Composer on Windows with a "^" in the version constraint

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

hockey2112’s picture

Version: 8.8.5 » 10.0.x-dev

#13 worked for me:

composer require drupal/views_simple_math_field:^^^^2.0@beta

ugintl’s picture

fvictoire’s picture

Version 9.3.3
#13 worked well for me
composer require 'drupal/flysystem:^^^^2.0@beta'