@drugan
Hello again :)
Couple of minutes ago I considered myself lucky for solving this problem. Now the joy is over :))
The command composer require "drupal/readmehelp:~1.0" solved my previous issue (composer require "drupal/readmehelp:~1.0.0" also works) and immediately thought that composer require "drupal/xnumber:~1.0" "drupal/commerce_xquantity:~1.0" will work as expected.
Well... it didn't...
composer require "drupal/xnumber:~1.0" "drupal/commerce_xquantity:~1.0"
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for drupal/readmehelp (locked at 1.0.0-beta1, required as ~1.0) -> satisfiable by drupal/readmehelp[1.0.0-beta1].
- drupal/xnumber 1.x-dev requires drupal/readmehelp dev-1.x -> satisfiable by drupal/readmehelp[dev-1.x].
- drupal/xnumber 1.0.0-alpha1 requires drupal/readmehelp dev-1.x -> satisfiable by drupal/readmehelp[dev-1.x].
- Conclusion: don't install drupal/readmehelp dev-1.x
- Installation request for drupal/xnumber ~1.0 -> satisfiable by drupal/xnumber[1.x-dev, 1.0.0-alpha1].
Installation failed, reverting ./composer.json to its original content.
The obvious question is... how to get over this?
I want to like all this composer stuff but this new method of installing modules really sucks compared to the normal tarball install. IMO, Drupal 8 really needs an initiative to solve this whole installing/updating mess...
Comments
Comment #2
drugan commentedThe reason is so called race condition which is quite a common issue also appearing on Drupal Commerce.
The reason behind the issue is quite complex but for the start you should know the following:
It is recommended always use composer to install Drupal modules. Yes, you may use core's built-in mechanism or drush or just placing a module into modules folder for installing the module but then don't use a composer method otherwise you might trigger race condition issue.
If you want to install a module and its dependencies (usually listed on a module's page) are not yet installed on your site then totally rely on composer to install them. So, let's say you want to install the latest 1 through 2 versions (beta, rc, stable) of the Commerce Extended Quantity then try to run this:
composer require "drupal/xquantity:~1.0.0"In the process composer will install with the module dev versions of the Extended Number Field and README Help modules which are dependencies. Why not beta versions? Just because all these modules are under active development right now and basically has not a lot of difference with the their beta or alpha versions. As soon as they'll get stable version then the dependency will also become stable. Actually, alpha or beta versions are mostly published for admins who don't use composer and prefer to build a site installing modules manually and update with the Drupal update system. In this case they will never get race condition issue as the dependencies listed in *.info.yml files does not denote any particular version leaving for the Drupal to decide which one to install. As a rule it chooses the latest not dev version (alpha, beta, rc or stable). Unlike this the composer never uses *.info.yml files and instead decides on dependecies denoted in the composer.json of the package (require). To make things more messy the Drupal testing system also use this file to install dependencies, not built-in modules installation system.
You may test this using simplytest.me link on the Commerce Extended Quantity module page. Install the site, then find the module on the admin/modules page, tick in the checkbox and then press the Install button to install everything what it needs. The go to admin/modules page again and find any module depending on the README Help module and click on the description to expand the module's info. As an example I've taken the README Help module because obviously it depends on itself:
As you see the beta versions is installed, not dev. If you'd install dev version then it will be like this:
Notice the README Help admin link to the module's help page, which is not merged yet for now with the beta version. Again, if you'd install the CEQ module using composer then you'd see exactly what is displayed on the second image. Also, notice that I don't use on my site the Drupal update mechanism at all and there is no
Install new modulebutton. Everything is composer and your life will become a little easier :)What to do if dependencies (beta) were already installed with some method and you'd stumbled on the current issue.
Try this:
composer require drupal/readmehelp:"dev-1.x"Then, repeat the same for the Extended Number Field module if you want to install beta version of the CEQ module and have ENF already istalled as beta:
composer require drupal/xnumber:"dev-1.x"No any other module depends on the CEQ module, so you can install the current beta version to have it automatically updated to a stable one without additional changes in composer.json file:
composer require drupal/xquantity:"~1.0.0"Comment #3
gge commentedDrugan your replies are very helpful and thank you for that!! Lots of good information!
I use drupal's built-in mechanism to test modules (the installation is faster) and I had no problems with yours.
After this post I decided to install Commerce Extended Quantity using composer and without knowing about "race condition" I started installing its dependencies, first README Help and second Extended Number Field.
The first module installed with Composer was README Help. I did not enabled it, just installed it with composer, so after running
composer remove drupal/readmehelpthe module was removed.Right now I have a "clean" composer.json file with no traces about README Help or Extended Number Field inside it.
My goal being the installation of Commerce Extended Quantity, I run
composer require "drupal/commerce_xquantity:~1.0"and the first thing CEQ tries to install isdrupal/readmehelp (dev-1.x b55ec75)which fails because there's no Git installed on this server.So if I'm not mistaken, right now it's impossible to have this combo (Commerce Extended Quantity + Extended Number Field + README Help) installed using Composer without having Git. Am I right or are some ways which I fail to see?
Thank you again for all your detailed replies!
Comment #4
drugan commentedNow I see. I had the same issue on one of my servers (shared) but was able to fix it by compiling git binary on my laptop and then uploading it on the server. Particularly, I've used this tutorial but google gives much more similar step-by-step instructions:
https://www.google.ee/search?client=ubuntu&hs=wJ3&channel=fs&dcr=0&ei=V6...
As the minimum you should have shell access on the server. And don't forget to put the git binary on your PATH in .bashrc file (on the server). That's it. Then just exit the shell and access it again and run:
git statusIt should give something like this:
fatal: Not a git repository (or any of the parent directories): .gitThat's OK. Now you have git installed. If it gives this:
bash: git-upload-pack: command not foundThen read here:
https://stackoverflow.com/questions/11128464/git-upload-pack-command-not...
So, now you can do such things as running composer on your local machine to install or update (download) Drupal Commerce with all its dependencies and commerce contribs (also with dependencies) and then create and commit everything into one huge local repository and then use this repository either to clone it locally for installing dev sites on a local server or push this repo onto the remote server (where you've installed static git). Read this gist:
https://gist.github.com/drugan/fd81d791d52c815f898e3bdd3af7dbef
The gist suggests to install my own fork of Drupal Commerce but you don't need to. Though it might be seen useful by some people because it automatically installs a lot of other modules along with the Drupal Commerce. A bit later I'll insert there the Commerce Extended Quantity (+Extended Number Fied and README Help), Commerce Extended Attributes, Commerce Quick Purchase and Commerce Creator (coming up) modules.
Comment #5
drugan commented@gge
I understand the complexity of the solution above, so I have an intention to fix this another way.
Can you help with quick testing of the solution? If it will not work then I just roll back the commit.
What I am going to do is to change the dependency constraints in composer.json all to NOT dev versions.
So, you can install the module (+dependencies) without having git on your server as in this case cloning is not required.
Comment #6
gge commented@drugan
I'm still trying to follow your advice but the problem is that my pc has different kernel and OS. The hosting hides the OS they are using and the kernel is 3.10.0-614.10.2.lve1.4.56.el7.x86_64 (output of
uname -a).Just discovered that I can use gcc, however curl.h is missing and now I'm looking for a solution to install this thing in order to get git installed
warning: curl/curl.h: No such file or directory.Another problem I encounter is that curl.h requires root privileges in order to install it. Maybe I will find a way to install everything without root access...
Comment #7
gge commentedThe greatest thing will be if you can change the dependencies. But since you opened my eyes in a different direction I will still try to get Git installed because I have a feeling that Drupal will soon require Git as well as they did with Composer. Your replies helped a lot!
Comment #8
drugan commentedThe OS you can install whatever in Virtualbox but kernel, yes should be the same...
OK, a bit later I'll try to change dependencies and let you know...
Comment #9
gge commentedDrugan thanks a lot for your time and for everything!!
Now, Commerce Extended Quantity and all its dependencies can be installed using composer without any problems!
Thank you~
Comment #10
drugan commentedOK, now I'll do the same for the https://www.drupal.org/project/commerce_xattributes and https://www.drupal.org/project/commerce_quick_purchase modules.
Good luck!
Comment #11
gge commentedSuper! First thing in the morning gonna install and play with them. Very helpful modules that improve commerce a lot!
Thank you for all your work!