Hi
I had a curious issue involving syntax and I was wondering if anyone has encountered the same issue.
I have two identical websites one staging and one live. On the staging site I used composer require as follows to install a Drupal 8 module which worked fine:
$ composer require "drupal/module_name:^1.0"

When I used exactly the same command on the other site it wouldn't work. I got it to work correctly by adding one space after the colon:
$ composer require "drupal/module_name: ^1.0"

Does anyone know why it works without the space on one site and with the space on another. The sites are identical and on the same server. I wasn't making these commands as super user.
I know in the composer.json file there is a space after the colon on all require entries. Should there be a space after the colon when making these commands? In all the examples I have seen there is no space after the colon?

Thanks for any help

Comments

Tebb’s picture

Hi Fistycuffs (Love the name :)

I think the format should be:

"drupal/module_name": "^1.0"

There's a single space after the colon, but not within the double quotes.

Per:  https://getcomposer.org/doc/01-basic-usage.md#the-require-key

Any help?

Kind Regards, Tebb