Composer syntax

Created on 26 April 2023, over 1 year ago

I am using Composer (2.5.5) from https://github.com/composer to install Drupal 9/10 and modules.
It works fine, but it is confusing with the syntax that Drupal provides in various modules.
Eg. "Entity Api" can be installed according to Drupal's syntax:
composer require 'drupal/entity:^1.4'

1: When I copy/paste the string to command-prompt in Windows10 and run it, I get the error:

In VersionParser.php line 521:

Could not parse version constraint 1.4': Invalid version string "1.4'"

require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [
...]

2: After removing the quotes from 'drupal/entity:^1.4' and trying to run composer, I get the following error:
The "1.4" constraint for "drupal/entity" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints

3: When I remove ^ from drupal/entity:^1.4 and try to run composer, I get the following error:
The "1.4" constraint for "drupal/entity" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints

4: When I write composer require drupal/entity:1.4.0 it is success.

What is the explanation for this?

💬 Support request
Status

Active

Version

1.0

Component

Miscellaneous

Created by

🇩🇰Denmark uv516 Denmark

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024