By ludootje on
Composer... Why, why, why... Okay, no whyning. Composer is the direction chosen by the powers that be. I try to use it. The past couple of days, however, typing this (on my localhost):
(....)\wamp\dru937>composer require 'drupal/entities_import:^1.2'(as suggested by the makers on https://www.drupal.org/project/entities_import ) leads to this:
In VersionParser.php line 519:
Could not parse version constraint 1.2': Invalid version string "1.2'"
require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--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] [--] [<packages>...]Searching for this "parse version constraint" on the forum has led to a number of threads, all quite arcane, to be honest. Is there anyone out here who can tell me what to do, and where to do??
Thanks ever so much.
Comments
Is your system (Windows)
Is your system (Windows) inserting smart quotes?
Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
As far as I can make out, no
As far as I can make out, no smart quotes are being inserted. ' remains ' and " remains " , the opening quote is the same as the closing quote.
Oh, the problem is the use of
Oh, the problem is the use of quotes in the first place. You should be using:
Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
Quotes or no quotes
I have been using the following syntax, because that is what is recommended on Drupal.org.
Drupalizeme aslo recommends the same syntax:
composer require 'drupal/token:^1.5'My understanding has been that different shells and different operating systems may deal with different quotes differently.
Thanks, Jaypan, leaving out
Thanks, Jaypan, leaving out the quotes appears to have done the trick. The composer command gave happy green characters on the screen: yay! The module itself, sadly, led to one of those absurdly long error messages full of silly CamelCase, without really helping, but that's another issue - the Composer problem has been solved.
Just wondering: if leaving out the quotes did the trick, then why did the makers of the module put them in the first place? See: Releases, on https://www.drupal.org/project/entities_import . They had better not do this - and they're not the only ones: quite a few other modules I tried to install a few days ago, gave the same problem - but sadly, I didn't keep track of them. Anyway, a warning that the quotes might give trouble, would be ever so welcome.
Once again: my thanks!
Maybe this works on other
Maybe this works on other systems and not windows. Or maybe your windows configuration is inserting a different type of quotes. I couldn't say.
Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
Had the same problem
Just for anyone reading this. I had the same problem. I tried to install on Windows, using cmd box, with the commands as recommended on the modules within quotes:
AND
both failed with
Leaving out the recommended quotes:
AND
worked well.
The documentation page https://www.drupal.org/node/2718229 states that the quotes are recommended to prevent problems on different shells. This actually puts you on the wrong track on Windows. Having read in this comment that I am not the only one that stumbled on this issue, I am submitting an addition to this documentation page stating that on Windows, the quotes actually might break the install and it is better to leave them out.
Addendum:
Later I noted that using double quotes DOES work on Windows.
e.g:
works.
Double quotes worked for me
Double quotes worked for me on windows 11 when upgrading D9 to D10 using the commands here: https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-...
Possible solution to " Could not parse version constraint"
I encountered the same problem in windows 11. The following solution worked for me.
I used the command without the quotation marks. Like:
composer require drupal/bootstrap:^5.0