2

We have a site that has been in production for a while and finally have been given the task of upgrading to Craft 4. We are at Craft Pro 3.4.29.1. Can I upgrade the site in stages? i.e. from 3.49 to 3.5, then 3.6, etc? I'm concerned about upgrading from such an old version.

Maybe setting the Craft version to 3.5 in composer.json and running the update with native composer instead of the craft cli?

Thanks!!

Duane

1 Answer 1

3

Yes, you can update to any version you want through Composer. Either manually edit the version of craftcms/cms in your composer.json, then run composer update, or use composer require to set the version. You may need to update other dependencies as well – for example, update some plugins to work with the installed Craft version. In this case, edit the composer.json and set all plugins / other dependencies to compatible versions, then run composer update. Composer will tell you if there are any version conflicts that need fixing.

The only thing to keep in mind is that after updating Craft or any plugins through Composer, you need to run any pending migrations manually (and to be safe, apply any pending project config changes):

  • php craft migrate/all
  • php craft project-config/apply

Two great articles on this topic:

2
  • Thank you very much for the speedy response. I've 'adjusted' composer before, but since I was so far behind on my updates, I didn't want to get into trouble. ;-)
    – Unlimited
    Commented Apr 11, 2023 at 14:35
  • @Unlimited Managing the Composer files manually is totally normal and expected! In fact, you'll have to do that anyway if you have any dependencies that aren't Craft plugins, since the Craft updater won't touch those. So its a good idea to get comfortable interacting with Composer directly. If you issue is solved, don't forget to mark the answer as accepted. Thanks!
    – MoritzLost
    Commented Apr 11, 2023 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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