Add React ^17.0.0 as peer dependency to support Gatsby v3 and "gatsby-plugin-netlify-cms": "^5.0.0"
phipag opened this issue ยท 26 comments
Describe the bug
With the release of Gatsby v3 and "gatsby-plugin-netlify-cms": "^5.0.0"
the move to React 17 has been made. netlify-cms-app
however requires React 16 as peer dependency. This is a request to add React 17.
To Reproduce
- Include
gatsby-plugin-netlify-cms": "^5.0.0",
and"netlify-cms-app": "^2.14.29"
to yourpackage.json
- Make sure you are on npm >=7.0 as this uses the new peer dependency resolution
- Run
npm install
Expected behavior
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: gatsby-i18n@0.1.0
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR! react@"^17.0.1" from the root project
npm ERR! peer react@"^16.9.0 || ^17.0.0" from gatsby-plugin-netlify-cms@5.0.0
npm ERR! node_modules/gatsby-plugin-netlify-cms
npm ERR! gatsby-plugin-netlify-cms@"^5.0.0" from the root project
npm ERR! 2 more (gatsby, react-dom)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.4" from netlify-cms-app@2.14.29
npm ERR! node_modules/netlify-cms-app
npm ERR! netlify-cms-app@"^2.14.29" from the root project
npm ERR! peer netlify-cms-app@"^2.9.0" from gatsby-plugin-netlify-cms@5.0.0
npm ERR! node_modules/gatsby-plugin-netlify-cms
npm ERR! gatsby-plugin-netlify-cms@"^5.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Current workaround
Use the npm --legacy-peer-deps
flag and install by npm install --legacy-peer-deps
Hi @erezrokah, I would like to work on this. How should I go about implementing this? ๐
Hi @BA1RY thanks. I would first update all the direct and peer dependencies in all the monorepo packages and see what breaks :) Updating React might require updating other dependencies as well.
Finally this should probably be under a major version release since it's a breaking change so we would need to see if we want to include anything else under that release (maybe an emotion + slate upgrade + dropping immutable).
@erezrokah So did you mean I should update all the direct and peer dependencies for all packages in https://github.com/netlify/netlify-cms/tree/master/packages to React 17? Please correct me if I'm wrong.
@erezrokah So did you mean I should update all the direct and peer dependencies for all packages in https://github.com/netlify/netlify-cms/tree/master/packages to React 17
๐ฏ You're correct - that would be the first step
@erezrokah Hey, I don't mean to be rude but, when is this going to be fixed? I can't use netlify cms with react@17.0.2 and I don't want to downgrade react to v16 because if I do, I will have to downgrade a lot of dependencies of my project and it would be just too much hassle. Is there a workaround of sorts?
Hi @arpitdalal, the CMS is a community project so the best way to fix this is via a contribution.
A workaround is suggested in the issue description:
@BA1RY, I think we could unblock users without having to do a breaking change. As the original issue suggests we can start by updating "react": "^16.8.4"
to "react": "^16.8.4 || ^17.0.0"
in our peer dependencies.
Please let me know if you'd like to start with that.
@erezrokah Sure, understood. I'll make the required changes.
Hi @erezrokah , I've made a PR according to your instructions. Made the changes for required packages inside https://github.com/netlify/netlify-cms/tree/master/packages. Please have a look at it. Thanks
Using the workaround I get:
Error: ObjectMiddleware.register: serializer for mini-css-extract-plugin/dist/CssModule/null is already registered
when including it in gatsby-config.js
Using the workaround I get:
Error: ObjectMiddleware.register: serializer for mini-css-extract-plugin/dist/CssModule/null is already registered
when including it ingatsby-config.js
Same issue here using gatsby-plugin-netlify-cms@~5.4.0
and gatsby@3.4.0
. Excluding the plugin removes the erroer (but is obivisously not a solution).
We are also facing same issue
Error: ObjectMiddleware.register: serializer for mini-css-extract-plugin/dist/CssModule/null is already registered
Can confirm the issue.
@erezrokah How should I go about fixing this?
Thanks @munwr, that surely solves the above error. ๐
It seems like a temporary fix and I wanted to know if there were any changes to be made in my PR to solve the above error in future releases.
FYI, we released netlify-cms@2.10.120-beta.0
and netlify-cms-app@2.15.0-beta.0
with the fix from #5316.
Can you please verify those versions solve the issue? Once the fix is verified we'll do an official release
Hi @erezrokah , it's working for me. Used "netlify-cms-app": "2.15.0-beta.0"
and "gatsby-plugin-netlify-cms": "5.3.0"
inside gatsby-starter-blog and installed them using npm install --legacy-peer-deps
. gatsby develop
runs successfully.
Hi @BA1RY, you should be able to install them without the --legacy-peer-deps
flag using npm@7
Hi @erezrokah , Just checked. It works with just npm install
๐
I can confirm that it works now.
Thanks @BA1RY for taking this on and everyone else that tested it.
This should be resolved in netlify-cms@2.10.120
and netlify-cms-app@2.15.0
via.
Please comment it upgrading to the latest version doesn't solve it.
Hi @arpitdalal, the CMS is a community project so the best way to fix this is via a contribution.
A workaround is suggested in the issue description:
I tried using yarn add netlify-cms-app@2.14.45 gatsby-plugin-netlify-cms@5.3.0 and it worked! The problem is that now i'm using yarn and npm together. Does anyone have any thoughts on how to solve this issue?
run npm install --legacy-peer-deps and upload your package-lock.json file too it will solve the dependency error ... I have tried it on netlify
Is anyone else encountering this issue?
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"17.0.2" from the root project
npm ERR! peer react@">=16.x" from @fortawesome/react-fontawesome@0.1.18
npm ERR! node_modules/@fortawesome/react-fontawesome
npm ERR! @fortawesome/react-fontawesome@"0.1.18" from the root project
npm ERR! 103 more (@gatsbyjs/reach-router, react-dom, @mdx-js/react, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0-0" from react-split-pane@0.1.92
npm ERR! node_modules/netlify-cms-core/node_modules/react-split-pane
npm ERR! react-split-pane@"^0.1.85" from netlify-cms-core@2.55.2
npm ERR! node_modules/netlify-cms-core
npm ERR! netlify-cms-core@"^2.55.2" from netlify-cms-app@2.15.72
npm ERR! node_modules/netlify-cms-app
npm ERR! netlify-cms-app@"2.15.72" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
It seems as though netlify-cms-app is depending on netlify-cms-core which is depending on react-split-pane -- which expects v16 while I'm on v17. I've never seen a sub-dependency depend on my top-level app's peer dependency
How is this solved?