react: "DevTools v4 is incompatible with this version of React" with React Native & latest version of React
Do you want to request a feature or report a bug? Bug What is the current behavior? After starting react-devtools, I get the following error message:
DevTools v4 is incompatible with this version of React
Either upgrade React or install React DevTools v3:
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn’t have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
- Use expo cli to initialize an expo app
- run
yarn add react@latestto ensure the most recent version of React is installed (currently v16.11.0) - run
yarn add react-devtoolsto install react-devtools - run
yarn startto start the app - run
npx react-devtoolsto open react-devtools
What is the expected behavior? react-devtools should work with React Native and the latest version of React
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? React 16.11.0 React Native 0.59.3 Fedora 30
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 28 (5 by maintainers)
@a-c-sreedhar-reddy First I tried to run
npm install -d react-devtools@^3but that was giving an error so I had to uninstall and reinstall.
npm uninstall -g react-devtoolsnpm install -g react-devtools@^3I had to downgrade react-devtools version. On new react-devtools page, they have documented that latest version wouldn’t work with react 0.61.3 but thats really annoying to release something which is not compatible with current version but the version to come.
react-native
0-0.61: Not supported 0.62: Will be supported (when 0.62 is released)
Here’s the source. https://reactjs.org/blog/2019/08/15/new-react-devtools.html
I use react native v0.61.3. Even then I am shown this error.
The same issue with:
react: 16.13.0react-native: 0.61.5react-devtools: 4.5.0@buddhikaranaweera its working for me now. But I dont think there is any use with v3 profiler. Because it crashes suddenly and I dont think it support hooks. It could be used for profiling.
@buddhikaranaweera In your project
yarn add react-devtools@^3 --devthen add"devtools": "react-devtools"to script in package.json and tryyarn devtools.BOOM…
I’m sorry folks. This confusion above was due to my misremembering which version of RN started using the new backend. It was version 62, not 61, as the React docs say. The React docs also show you how to downgrade to the previous version of DevTools if you’re using an older version of React Native.
I understand this frustration, but DevTools is used by a lot of people that aren’t React Native developers too. For example, the new package is used by web developers working with Safari, Code Sandbox users (since the new DevTools is embedded in the Code Sandbox IDE), and Chrome/Firefox users.
I’m afraid that new devtools support react-native starting from 0.62(that not released yet) Proof: react and react-native versions that react-devtools@^4 supports
I think this might benefit from having someone whose more plugged into the React Native ecosystem take a look. I’m not sure what else might be triggering that old backend message, but something seems to be or the error wouldn’t be showing.
Doesn’t sound right. That message is only shown if the DevTools frontend gets a message that the only the v3 backend sends: https://github.com/facebook/react/blob/273679a78ca0e3561ad3eaac1349187aff8548ab/packages/react-devtools-shared/src/devtools/views/WarnIfLegacyBackendDetected.js#L26-L31
Seems to me like you’ve got an older version of React Native (which embeds the v3 backend) running.