Skip to content

[Bug]: Migration guide in v4 is missing a breaking change #2576

@icefo

Description

@icefo

Link to the documentation page or resource

https://docs-v4.strapi.io/dev-docs/migration-guides

Describe the bug

I had a really old version of strapi v4 that I upgraded, following the migration guides up to the latest 4.15.5. Things went well and since there was no migration notes since 4.15.5, I went straight to 4.25.22. Yarn install worked but yarn build failed because react is now an explicit dependency.

I found this thread on the strapi forums and the solution there worked (merge the packages.json of a new strapi installation with mine).

I also wonder if the migration guides should use the ~ (eg "~4.15.5" instead of "4.15.5") to get the latest patch instead of the exact version. I did that and it went fine but there may be gotchas I don't know.

Do you also know why react became an explicit dependency ? It seems it's going to complicate future upgrades too.

Additional context

No response

Suggested improvements or fixes

Here is the naive upgrade of the dependencies:

"dependencies": {
"@strapi/strapi": "~4.25.22",
"@strapi/plugin-users-permissions": "~4.25.22",
"@strapi/plugin-i18n": "~4.25.22",
"pg": "^8.16.3",
"strapi-plugin-populate-deep": "^3.0.0"
},

Here is the correct one:

"dependencies": {
"@strapi/strapi": "~4.25.22",
"@strapi/plugin-users-permissions": "~4.25.22",
"@strapi/plugin-i18n": "~4.25.22",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "5.3.4",
"styled-components": "5.3.3",
"pg": "^8.16.3",
"strapi-plugin-populate-deep": "^3.0.0"
},

I'm also using postgres and a plugin but they are not part of the problem.

Related issue(s)/PR(s)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions