Hi there,
I'm new to D8 and Composer so, I'm playing around with an installation to learn.
Just managed to create a new project as per instructions at https://www.drupal.org/docs/develop/using-composer/using-composer-to-ins...
I used this command and I received a congratulations message
composer create-project drupal/recommended-project:8.9.6 barbI did the set up using the standard web interface and the site is up an running without any error
Then I tried to install the module Admin Toolbar at https://www.drupal.org/project/admin_toolbar with
composer require drupal/admin_toolbarand got this error
[InvalidArgumentException]
Could not find a matching version of package drupal/admin_toolbar. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable).
Also tried to install the module SMTP Authentication Support at https://www.drupal.org/project/smtp using
composer require drupal/smtpand got the same error
[InvalidArgumentException]
Could not find a matching version of package drupal/smtp. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable).
Both of the command lines were taken from the modules' project pages
I'm in a shared hosting and doing this installation in using subdomain like sub.mydomain.com
I'd think I'm obviously doing something wrong.
I'm no programmer, I've developed a few D7 sites and starting to play around with D8 and Composer for a new project that I will be starting soon and I'd like to do it this way.
What am I doing wrong? Anyone could point me in the right direction?
Thanks
Manu
Comments
Can't reproduce in my environment
See protocol:
thanks jjmvb but as I said I
thanks jjmvb but as I said I'm new to this so don't have a clue what all that means :(
I've tried those two modules as I could have tried any other, the point is it won't allow me to install any module from composer getting the same message all the time. Which makes me think I'm doing something wrong.
Could you please specify a bit?
Thanks
You should have a clue
At least it shows what it should have looked like. Note, due to difficulties with this project template I didn't install the site yet. The first thing to look at is always the version of Composer in use.
The protocol shows what you should see. Just repeat it in your environment and verify what happens. Report what is different, be specific when you do.
ok, I'll do that and report
ok, I'll do that and report
Thanks a lot
Manu
Look on the module's project
Look on the module's project page for composer installation syntax. For instance, admin toolbar would be:
$ composer require 'drupal/admin_toolbar:^2.3'Not sure where you are installing it. I have found that from a Windows command prompt screen you have to leave the single quotes out in the command, i.e., $ composer require drupal/admin_toolbar:^2.3Drupal developers are Windows averse (IMHO) and I've found that if you leave those single quotes in the command will just fail without meaningful explanation. Welcome to command line.I'm working on a shared
I'm working on a shared hosting with LINUX PHP 7.2.33 MySQL 5.5 from a windows pc through the SSH hosting service web console.
I tried that an got the same answer
Thanks
You might want to check whether the repository is availble
Use `composer config repos` and verify there is packages.drupal.org mentioned.
As an alternative you could `composer show drupal/admin_toolbar --all` to see whether the repository for drupal is accessible.
Also, composer commands must be executed when in the folder you created: /var/www/barb in my environment. Looks like you executed them from a folder without a composer.json.
I haven't had time to
I haven't had time to reinstall and get the full report :(,
I've tried the
command and gives me this answer "[InvalidArgumentException], Package drupal/admin_toolbar not found", which I guess is normal as it hasn't been installed yet, is it?
Not exactly that, barb is not under www/ but at the same level and the sub.mydomain.com points to barb/web. I did it like that because this tutorial says;
However I have the feeling that my problem may have to be something related to where I'm giving the commands (the ssh web hosting IU) and where the drupal installation is ¿?¿?¿?
This is the hosting estructure
To get composer running I use
and the this
I've tried
but I get a "Could not open input file: barb/composer.phar"
I'm on Composer version 1.10.13 2020-09-09 11:46:34
Thanks :)
====
Should give you similar output as I provided above. No, the error means it can't find such package in the repos you mentioned for your project.
Your current directory (pwd) needs to be ...../barb when executing the above composer commands. It should contain a composer.json with the repo for drupal 8
How and where composer itself is installed is irrelevant. It either works or not. Consider your current installation of Composer in the wrong place. Obviously, php needs to see composer.phar. The location of composer.phar must be in your PATH for php to find it, as it won't be in the current directory.
Ok, lets start from 0 ... I
Ok, lets start from 0 ... I've created a new project using
I got this report
My sub.mysite.org points to user/d8cbarbt/web
I run the installer from my d8cbarbt.mysite.org and have a brand new d8 working fine with a "All fine 27 CHECKED details" at the status reports.
Right after I try to install Admin toolbar (or other modules for the matter) with the recommended command at the projects pages and I get;
I don't know if this is of any value ... W the command I use to get composer runing is
Thanks :)
manu
I forgot, I can install and
I forgot, I can install and enable both Adminimal theme and Admin Toolbar module from URL from the web IU and get them up and running without a problem
No surprise there!
As mentioned several times and you concluded that yourself: ran from the wrong location!
You need to be in d8cbarbt when running the `composer require` commands!
ok,
ok,
the command I use to get composer running is,
and then
so, how do I run it from d8cbarbt ?
if I try with php d8cbarbt/composer.phar
I'm completely new to command line :(
NO,NO,NO Last attempt
I get this
I get this
I'm thinking why it says "Could not open input file: composer.phar"? ... but actually composer is not installed in that folder but one level higher, so it's no surprise it cant find it.
So, after D8 installation , do I need to move/reinstall composer inside my d8cbarbt? ... I mean before doing the d8 install, composer was installed in my user root (I believe), do I have to "somehow" move composer to /folder/for/my/project or install it again there?
Or, could this be a problem of permissions with user within my hosting?
I must be stupid, I bet is something very easy :( ;)
composer should be made available no matter your current directo
That is done by adding the folder to your PATH
Finally I manage to install
Finally I manage to install smtp with composer
but I had to use
instead of
which I guess is the standard as is what all modules give as a command "composer require drupal/module"
Luckly it's working which is whats important, however why my server forces my to use "php composer.phar require drupal/smtp" instead or "composer require drupal/smtp"? I guess must be some setting withing the server that I may or not (as I'm in a shared hosting)
However ... now that I manage
However ... now that I manage to start installing modules (so far only 1) I try to install module filter and I get another error
"Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108864 bytes) in"
also tried with a couple of modules and got the same
This is obviously a memory limit that must be increased, I'll check with the hosting service.
try php -d memory_limit=-1 composer. phar
or export COMPOSER_MEMORY_LIMIT=-1;
in your shell.
using
using
I got it done :)
Thank you very much for all your help mmjvb
I couldn't have done it without you :)
You are welcome
Glad to see you managed to get it work. Working on the command line can be intimidating. Suggest to score some youtube intro's on working on the command line. Your issues were related to not having a basic understanding of working on the command line.
yep, I'm looking for some
yep, I'm looking for some tutorials for newbies before I get something more complicated, I'd like start using git and drush too for my projects.
Thanks