Answers.Body: <p><strong>To upgrade to Craft 4, you'll need to make sure that Composer is allowed to upgrade all of your plugins to their Craft 4 compatible releases as well. This is done by manually editing your installed plugins' version constraints in your <code>composer.json</code> file.</strong></p>
  <p>The reason why this is necessary is that most plugins are bumping their major version for the Craft 4 compatible release – for example, Feed Me is going from version 4.x to 5.x for the Craft 4 compatible release – and in most cases, <strong>Composer isn't able to upgrade an installed package to a new major version automatically</strong>. This is due to <a href="https://getcomposer.org/doc/articles/versions.md" rel="nofollow noreferrer">version constraints</a> in the <code>composer.json</code> file, and in general this is a good thing – major version upgrades often include breaking changes, and those constraints prevent Composer from accidentally upgrading to a version that could break your application.</p>
  <p>As an example: in order to allow Composer to update Feed Me to the Craft 4 compatible version, you'll need to change the <code>craftcms/feed-me</code> package's version constraint from this:</p>
  <pre><code>&quot;require&quot;: {
      ...
      &quot;craftcms/feed-me&quot;: &quot;4.5.1&quot;
      ...
    },
  </code></pre>
  <p>To this:</p>
  <pre><code>&quot;require&quot;: {
      ...
      &quot;craftcms/feed-me&quot;: &quot;^5.0.0&quot;
      ...
    },
  </code></pre>
  <p>You'll need to step through each of your installed plugins to find the version you need to add to your <code>composer.json</code> file. The easiest way to do that is probably visiting the new &quot;Craft 4 Upgrade&quot; utility, which is found under Utilities -&gt; Craft 4 Upgrade inside the Control Panel. This utility is available in Craft 3.7.39 or later, and lists all the latest, compatible versions for any and all plugins installed.</p>
  <p>Note that some plugins may still be in beta for their Craft 4 compatible release. If so, make sure to add the <code>-beta</code> part to the version constraint for that plugin as well, i.e. so it looks like this:</p>
  <pre><code>&quot;require&quot;: {
      ...
      &quot;nystudio107/craft-retour&quot;: &quot;^4.0.0-beta&quot;
      ...
    },
  </code></pre>
  <p>After making sure that all plugins have a Craft 4-compatible version constraint declared in your <code>composer.json</code> file, run <code>composer update</code>.</p>
  <p>If that didn't work and you're still getting Composer errors – and some of your plugins' versions are in fact beta releases – try adding the following rules to your <code>composer.json</code> file:</p>
  <pre><code>&quot;minimum-stability&quot;: &quot;beta&quot;,
  &quot;prefer-stable&quot;: true,
  </code></pre>
  <p>Then try <code>composer update</code> again.</p>
  <p>Also note the <a href="https://craftcms.com/docs/4.x/upgrade.html#performing-the-upgrade" rel="nofollow noreferrer">official Craft 4 upgrade guide</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-10T19:50:32.293Z
Answers.Text: Nice, this make a huge difference and I "almost" managed to make it to work completely. Well I took off one plugin for now (Image Optimizer) which was giving me a lot of pain in ... and all the rest is fine. Now a few minor Twig changes and I should be on my way to complete migration. 
  Thank you Pal !!!
Answers.UserDisplayName: Sylvain Tremblay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-17T14:13:02.583Z
Answers.Text: this really should be added to the official documentation for everyone who's not so composer savvy.
Answers.UserDisplayName: erwinheiser
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-01T17:31:14.920Z
Answers.Text: Agreed, I even remembered this was the case from reading it a while ago, but was still confused when I went to actually update. This part of the documentation: "Edit your project’s composer.json to require...Craft-4-compatible plugins..." is frustratingly vague. It would be great if that linked out to an explanation of the (cumbersome but understandably necessary) required step of manually updating each plugin's major version in your composer.json file.
Answers.UserDisplayName: Nate Beaty
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-10T19:09:12.267Z
Answers.LastActivityDate: 2022-05-12T21:40:44.807Z
Answers.LastEditDate: 2022-05-12T21:40:44.807Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>Anyone succeeded in upgrading from Craft 3 to Craft 4 ?</p>
  <p>Before staging the changes on our dev server, I tried it locally without success. Although it seems pretty strait forward, I updated all plugins (2 of them are not compatible, so I took them off for now as we're not using it yet on dev - reCaptcha and Kint), took care of all deprecation warnings, did the project-config/rebuild and change craftcms/cms to ^4.0.0 and obviously move to PHP 8. Here's a sampler of my installation.</p>
  <p><a href="https://i.sstatic.net/G172P.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/G172P.png" alt="enter image description here" /></a></p>
  <p>Next step would be composer update, but can't pass this step with success. See other picture of all conflicts...  As usual, your input would be greatly appreciated !</p>
  <p>Sylvain</p>
  <p><a href="https://i.sstatic.net/Og0hp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Og0hp.png" alt="enter image description here" /></a></p>
  
Tags: <migration><craft4>
Title: Upgrade to Craft 4
ThreadText: # Upgrade to Craft 4
  
  (Asked by: username_0 on 2022-05-10)
  
  Anyone succeeded in upgrading from Craft 3 to Craft 4 ?
  
  Before staging the changes on our dev server, I tried it locally without success. Although it seems pretty strait forward, I updated all plugins (2 of them are not compatible, so I took them off for now as we're not using it yet on dev - reCaptcha and Kint), took care of all deprecation warnings, did the project-config/rebuild and change craftcms/cms to ^4.0.0 and obviously move to PHP 8. Here's a sampler of my installation.
  
  [![enter image description here](https://i.sstatic.net/G172P.png)](https://i.sstatic.net/G172P.png)
  
  Next step would be composer update, but can't pass this step with success. See other picture of all conflicts... As usual, your input would be greatly appreciated !
  
  username_0
  
  [![enter image description here](https://i.sstatic.net/Og0hp.png)](https://i.sstatic.net/Og0hp.png)
  
  **Tags:** migration, craft4
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-05-10. Score: 4 | Accepted answer
  
  **To upgrade to Craft 4, you'll need to make sure that Composer is allowed to upgrade all of your plugins to their Craft 4 compatible releases as well. This is done by manually editing your installed plugins' version constraints in your `composer.json` file.**
  
  The reason why this is necessary is that most plugins are bumping their major version for the Craft 4 compatible release – for example, Feed Me is going from version 4.x to 5.x for the Craft 4 compatible release – and in most cases, **Composer isn't able to upgrade an installed package to a new major version automatically**. This is due to [version constraints](https://getcomposer.org/doc/articles/versions.md) in the `composer.json` file, and in general this is a good thing – major version upgrades often include breaking changes, and those constraints prevent Composer from accidentally upgrading to a version that could break your application.
  
  As an example: in order to allow Composer to update Feed Me to the Craft 4 compatible version, you'll need to change the `craftcms/feed-me` package's version constraint from this:
  
  ```
  "require": {
      ...
      "craftcms/feed-me": "4.5.1"
      ...
    },
  
  ```
  
  To this:
  
  ```
  "require": {
      ...
      "craftcms/feed-me": "^5.0.0"
      ...
    },
  
  ```
  
  You'll need to step through each of your installed plugins to find the version you need to add to your `composer.json` file. The easiest way to do that is probably visiting the new "Craft 4 Upgrade" utility, which is found under Utilities -> Craft 4 Upgrade inside the Control Panel. This utility is available in Craft 3.7.39 or later, and lists all the latest, compatible versions for any and all plugins installed.
  
  Note that some plugins may still be in beta for their Craft 4 compatible release. If so, make sure to add the `-beta` part to the version constraint for that plugin as well, i.e. so it looks like this:
  
  ```
  "require": {
      ...
      "nystudio107/craft-retour": "^4.0.0-beta"
      ...
    },
  
  ```
  
  After making sure that all plugins have a Craft 4-compatible version constraint declared in your `composer.json` file, run `composer update`.
  
  If that didn't work and you're still getting Composer errors – and some of your plugins' versions are in fact beta releases – try adding the following rules to your `composer.json` file:
  
  ```
  "minimum-stability": "beta",
  "prefer-stable": true,
  
  ```
  
  Then try `composer update` again.
  
  Also note the [official Craft 4 upgrade guide](https://craftcms.com/docs/4.x/upgrade.html#performing-the-upgrade).
  
  > **Comments:**
  > **username_0**: Nice, this make a huge difference and I "almost" managed to make it to work completely. Well I took off one plugin for now (Image Optimizer) which was giving me a lot of pain in ... and all the rest is fine. Now a few minor Twig changes and I should be on my way to complete migration.  Thank you Pal !!!  
  > **username_2**: this really should be added to the official documentation for everyone who's not so composer savvy.  
  > **username_3**: Agreed, I even remembered this was the case from reading it a while ago, but was still confused when I went to actually update. This part of the documentation: "Edit your project’s composer.json to require...Craft-4-compatible plugins..." is frustratingly vague. It would be great if that linked out to an explanation of the (cumbersome but understandably necessary) required step of manually updating each plugin's major version in your composer.json file.  
  
  ---
  
  