Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native Debugger doesn't use the global react-devtools version and still shows 'Unsupported' error #620

Closed
bogdandevlpr opened this issue Jun 7, 2021 · 31 comments

Comments

@bogdandevlpr
Copy link

Hello all,

I'm having trouble using react native debugger. I get the 'Unsupported' error telling me to downgrade to 4.11.0.
After I ran npm i -g react-devtools@"4.11.0", it installed the [email protected] version globally. I checked that with npm list -g and it was installed correctly.

The issue is that even though I have the react-devtools version 4.10.4 installed globally, I still see the same 'Unsupported' error message.

In the react native debugger app, the DevTools header still indicates version 4.13.4-51ebccc374 which I guess was installed by default when I installed react native debugger.

It seems that React Native Debugger doesn't use the global react-devtools version.

I installed react native debugger with homebrew: brew install --cask react-native-debugger

I already tried uninstalling react native debugger, react-devtools and reinstalling everything again. With no success though..

Any ideas what else can I try ?

React Native Debugger app version: 0.11.9
React Native version: 0.62.2
Platform: iOS
Operating System: macOS Big Sur 11.4
Homebrew version: 3.1.9

@jhen0409
Copy link
Owner

jhen0409 commented Jun 7, 2021

Please see the release note:

Note about React DevTools

If you got Unsupported message or some errors from React DevTools, please read the documentation first.

Question: I got Unsupported meesage from React DevTools

If you're using React Native version >= 0.62 and keep React Native Debugger as the latest version, here is what you can do:

In your app project, upgrade react-devtools-core dependency to match the React DevTools version:

  • OPTION 1: Just yarn upgrade react-native
  • OPTION 2: Delete react-devtools-core block in yarn.lock, then re-install dependencies by yarn

@jhen0409 jhen0409 closed this as completed Jun 7, 2021
@Arkan4ik
Copy link

Arkan4ik commented Jun 8, 2021

@jhen0409 it does not work and not clear solution. I removed from yarn.lock as you wrote, but got error when run application. Then I installed react-dev-tools in dev dependency and project start working, but error that 'Unsupported DevTools backend version' is still reproduced. It is annoing thing espacially if you have several projects with different react native version.

@jhen0409
Copy link
Owner

jhen0409 commented Jun 8, 2021

it does not work and not clear solution. I removed from yarn.lock as you wrote, but got error when run application.

@Arkan4ik what error did you got from running application?

Here is another method:

  • Use yarn resolutions, just add "react-devtools-core": "^4.13.4" to resolutions of package.json.

@Arkan4ik
Copy link

Arkan4ik commented Jun 8, 2021

@jhen0409 thanks. yarn resolutions and then updating global package works. I also see that you updated the doc. Awesome. Thank you

@jack-ayoka
Copy link

@jhen0409 I'm still receiving this error after trying all 3 options. My package-lock.json has react-devtools version 4.13.4, same as the one in the debugger. Then i run npx react-native run-android, and I get the 'Unsupported' error.
To clarify, does the backend version(react native renderer) rely on the frontend version(react native debugger)? Because having to update the dependencies of production code to work with the debugger seems wrong...

Is there any way to manually set the frontend version being used by RN Debugger?

@Arkan4ik
Copy link

Arkan4ik commented Jun 9, 2021

@jack-ayoka I can describe what I did.

  1. in your package json add resolution

  1. yarn/npm install - it will change in yarn.lock/package-lock file version of react-dev-core

  2. install globally react-devtools if you don't have

  3. paste command from RN debugger which you receive in terminal and execute.

@jack-ayoka
Copy link

@jack-ayoka I can describe what I did.

  1. in your package json add resolution
  1. yarn/npm install - it will change in yarn.lock/package-lock file version of react-dev-core
  2. install globally react-devtools if you don't have
  3. paste command from RN debugger which you receive in terminal and execute.

After banging on this for hours yesterday, this worked!!!!! thank you so much!
Do note, i also had to uninstall react-devtools and react-devtools-core from my local project. so the only thing referencing react-devtools locally was react-native, and the 'resolutions' section.

@vishnuc
Copy link

vishnuc commented Jul 7, 2021

I have referred the documentation , but its the same issue

@10n37
Copy link

10n37 commented Jul 7, 2021

I have referred the documentation , but its the same issue

if you use npm, delete package.lock and install again with yarn, it helps me..

@vishnuc
Copy link

vishnuc commented Jul 7, 2021

I use npm , for some reasons my expo project breaks if i run yarn.. so any solutions with NPM ?

@0x0a0d
Copy link

0x0a0d commented Dec 27, 2021

for anyone who still find solution
Note: I'm running MacOS 10.15.7 (19H114)

first download react-native-debugger. Then you must open it at least 1 time

npm i -g asar
asar e /Applications/React\ Native\ Debugger.app/Contents/Resources/app.asar /tmp/app
cd /tmp/app

# option 1
npm install react-devtools-core@^4 # or 4.22.1

## option 2
## If you still unlucky, try edit `/tmp/app/package.json` as photo below, then execute next line
# npm update react-devtools-core

# last step
asar p . /Applications/React\ Native\ Debugger.app/Contents/Resources/app.asar

image

@anttiabel
Copy link

The "Unsupported DevTools backend version" error persists for me, having tried everything listed. The tool seems bent on using react-devtools 4.14.0-d0ec283819 no matter how I try to upgrade to 4.22.1 everywhere for both react-devtools and react-devtools-core. I am working on an Expo project, on a Mac.

@frags51
Copy link

frags51 commented Jan 11, 2022

Same for me as @anttiabel

@garrettg123
Copy link

garrettg123 commented Jan 12, 2022

Exact same as @anttiabel. I am making a new issue as it seems to be re-broken.

EDIT: Changing to use the resolution of the version that RND is using fixed this issue:

  "resolutions": {
    "react-devtools-core": "4.14.0"
  },

DO NOT upgrade to 4.22.1, remove all of those and just add this resolution (in my case with yarn workspaces to the package.json that contains the RN project).

@tam315
Copy link

tam315 commented Jan 13, 2022

I found 4.22.1 >= react-devtools-core doesn't seem to be compatible with RNDebugger.

Minimal reproductive sample:
facebook/react#23035 (comment)

@kidproquo
Copy link

Exact same as @anttiabel. I am making a new issue as it seems to be re-broken.

EDIT: Changing to use the resolution of the version that RND is using fixed this issue:

  "resolutions": {
    "react-devtools-core": "4.14.0"
  },

DO NOT upgrade to 4.22.1, remove all of those and just add this resolution (in my case with yarn workspaces to the package.json that contains the RN project).

This worked for me. Started a brand new RN app, using CLI. Debugger showed version mismatch error. Added the resolution to 4.14.0. Ran yarn install. Rebuilt app. Debugger works.

@mjstelly
Copy link

@garrett-gottlieb I added the resolutions entry to my package.json, restarted metro bundler with --reset-cache flag, and relaunched my app. No change. Same error. Any thoughts?

@bfricka
Copy link

bfricka commented Jan 24, 2022

@garrett-gottlieb I added the resolutions entry to my package.json, restarted metro bundler with --reset-cache flag, and relaunched my app. No change. Same error. Any thoughts?

Did you yarn install / yarn dedupe after changing the resolutions?

@Kawinesh
Copy link

For me the error never went even if i added the below and did a npm i (expo project) and also i tried all possible solutions as well with NPM

"resolutions": {
    "react-devtools-core": "4.14.0"
  },

So i created a new expo project with yarn now instead of npm and added the above in package.json and run yarn install and yarn start surprise react native debugger worked with the Unsupported error (Tested only in android)

@rossjackson
Copy link

For me the error never went even if i added the below and did a npm i (expo project) and also i tried all possible solutions as well with NPM

"resolutions": {
    "react-devtools-core": "4.14.0"
  },

So i created a new expo project with yarn now instead of npm and added the above in package.json and run yarn install and yarn start surprise react native debugger worked with the Unsupported error (Tested only in android)

This worked for me! I was using npm and switched to yarn. I had to rm -r node_modules and rm -r package-lock.json and do yarn install (npm i -g yarn if you don't have yarn yet) and surprisingly it worked!

@rossjackson
Copy link

For npm lovers, you can add a "preinstall": "npx npm-force-resolutions" script on your package.json. This will force the resolutions found on your package.json. More info here. Once you do an npm i you should see if the react-devtools-core is set to 4.14.0 (command: npm ls react-devtools-core) if not, do another npm i and it should resolve it to 4.14.0

@joey-harward
Copy link

for anyone who still find solution Note: I'm running MacOS 10.15.7 (19H114)

first download react-native-debugger. Then you must open it at least 1 time

npm i -g asar
asar e /Applications/React\ Native\ Debugger.app/Contents/Resources/app.asar /tmp/app
cd /tmp/app

# option 1
npm install react-devtools-core@^4 # or 4.22.1

## option 2
## If you still unlucky, try edit `/tmp/app/package.json` as photo below, then execute next line
# npm update react-devtools-core

# last step
asar p . /Applications/React\ Native\ Debugger.app/Contents/Resources/app.asar

image

This was exactly the fix that worked for me. Thanks!

@dkang23
Copy link

dkang23 commented Feb 6, 2022

I "npm install"ed 'react-devtools' and 'react-devtools-core' and set them to the same version

"react-devtools": "~4.14.0",
"react-devtools-core": "~4.14.0",

and re-installed everything by deleting package-lock.json and node_modules

then ran npm install and it worked

I think the problem was those packages not being the same version

@cglacet
Copy link

cglacet commented Feb 8, 2022

Why is every comment suggesting to pin to something like 4.14.0 when the error message says <4.11? Is the error message wrong and the requirement is rather >4.11?

I'm really confused by this error message.

@stenes90
Copy link

stenes90 commented Apr 5, 2022

For npm lovers, you can add a "preinstall": "npx npm-force-resolutions" script on your package.json. This will force the resolutions found on your package.json. More info here. Once you do an npm i you should see if the react-devtools-core is set to 4.14.0 (command: npm ls react-devtools-core) if not, do another npm i and it should resolve it to 4.14.0

This worked for me. Tnx

@jwboardman
Copy link

Why is every comment suggesting to pin to something like 4.14.0 when the error message says <4.11? Is the error message wrong and the requirement is rather >4.11?

I'm really confused by this error message.

Your comment is what finally saved me! I changed my resolutions to:
"resolutions": {
"react-devtools-core": "4.14.0"
},

and the error FINALLY WENT AWAY! Thank you! The error message has to be wrong.

@shawngustaw
Copy link

for anyone who still find solution Note: I'm running MacOS 10.15.7 (19H114)

first download react-native-debugger. Then you must open it at least 1 time

npm i -g asar
asar e /Applications/React\ Native\ Debugger.app/Contents/Resources/app.asar /tmp/app
cd /tmp/app

# option 1
npm install react-devtools-core@^4 # or 4.22.1

## option 2
## If you still unlucky, try edit `/tmp/app/package.json` as photo below, then execute next line
# npm update react-devtools-core

# last step
asar p . /Applications/React\ Native\ Debugger.app/Contents/Resources/app.asar

image

This worked for me. Thank you!

@alexlukelevy
Copy link

For npm, simply add

"overrides": {
    "react-devtools-core": "4.14.0"
},

@zn7726
Copy link

zn7726 commented May 30, 2022

Why is every comment suggesting to pin to something like 4.14.0 when the error message says <4.11? Is the error message wrong and the requirement is rather >4.11?

I'm really confused by this error message.

You asked the question that I was confused with after reading all these comments and how ppl reporting solutions are working!

the error message seemed to me mean that RND was expecting react-devtools with version <4.11 but a higher version is always used. With that impression in mind, I have been trying to link an earlier version of react-devtools-core to the app, including by adding the resolution clause in the package.json. I checked the globally installed react-devtools in yarn and npm and made sure they are all of version 4.10.4, specify the version 4.10.4 in the resolution clause and etc. but non worked. Of course those changes won't be helpful because the direction was wrong!

Once I changed the resolution section to specify the react-devtools-core to 4.14.0, ran yarn, and restarted the app, wow, all working now!

@garawaa
Copy link

garawaa commented Aug 6, 2022

I just edited my package.json file like below:
In first line of defendencies block added
"react-devtools": "~4.14.0",
"react-devtools-core": "~4.14.0",
For examle:

  "dependencies": {
    "react-devtools": "~4.14.0",
    "react-devtools-core": "~4.14.0",
    "react": "17.0.2",
    "react-native": "0.68.2"
  },

And added

  "resolutions": {
    "react-devtools-core": "4.14.0"
  },

before last code block:

  "resolutions": {
    "react-devtools-core": "4.14.0"
  },
  "jest": {
    "preset": "react-native"
  }

If you are using yarn, delete yarn.lock file and run yarn install
if you are using npm, delete package-lock.json file and run npm install
Enjoy!

@karlhorky
Copy link

Seems like #706 is the PR to fix this by upgrading react-devtools-core in react-native-debugger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests