1

I have a problem when updating with Composer.

My installation command line was this one:

php composer.phar create-project -s RC craftcms/craft $HOME/craft

As such, I tried to update, as per Ryan from Mijingo instructions:

php composer.phar update craftcms/craft

But I ended up with the following error:

Composer could not find a composer.json file in /home/me
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

I checked, composer.json and composer.lock are in the craft directory, as expected.

After looking through Composer man page and web docs, I am still clueless, as I haven't found what -s RC are used for in the installation command. I believe understanding these (this?) switches is probably the key, but I rather ask here than making a mistake and blowing the otherwise perfectly working install. ^^

As for the CP, it doesn't work either, but that is not a surprise given the command line didn't and that I am using the php composer.phar method rather than the sole composer one.

  • Why don't you just use composer update in your craft directory where your composer.json file is? You can install it with php composer.phar create-project -s RC craftcms/craft $HOME/craft but you should still be able to update with the normal composer. Are there certain reasons why you don't want to do it? – Robin Schambach Jan 3 '18 at 10:52
  • Because when I run 'php composer.phar' from the 'craft' directory, I get this: Could not open input file: composer.phar – Braintrash Jan 3 '18 at 10:58
  • That's why you should do composer update not php composer.phar – Robin Schambach Jan 3 '18 at 11:00
  • 'composer: command not found' – Braintrash Jan 3 '18 at 11:14
  • Then - if you don't mind - installing the required package might be a good idea. If you have Windows getcomposer.org/doc/00-intro.md#installation-windows click on the download link and install it. Do you have a valid composer.json in your craft directory? – Robin Schambach Jan 3 '18 at 11:18
1

So, not all hosts allow just using composer and impose to use php composer.phar.

Knowing that, I can now answer my two questions:

  1. When installing Craft using php composer.phar create-project -s RC craftcms/craft $HOME/craft, the -s switch is just telling which branch of the source project to use. Here, RC stands for Release Candidate. Before that, we had to use -s BETA in order to install the betas. Something I didn't knew since I waited for the RC to jump in Craft 3 and start over from Craft 2.

  2. When you want to update using php composer.Phar, you need to go inside your project folder (where you installed Craft; craft for me which means once logged I had to cd craft) and then type php ../composer.phar update, where ../composer.phar tells to go looking for Composer from the parent folder.

I am ashamed not having thought of that; I really need to stop overthinking things.

| improve this answer | |
  • Thanks for the follow up and no need to be ashamed! – Brad Bell Jan 3 '18 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.