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 run-android is giving error undefined is not a function (evaluating 'react DevTools.connect DevTools') #22865

Closed
ghost opened this issue Jan 4, 2019 · 24 comments
Labels
Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@ghost
Copy link

ghost commented Jan 4, 2019

Environment

React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz
Memory: 1.44 GB / 7.91 GB
Binaries:
Yarn: 1.9.4 - C:\Users\Yajana\AppData\Roaming\npm\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
Watchman: 4.9.0 - C:\Shortcut\watchman.EXE
IDEs:
Android Studio: Version 3.0.0.0 AI-171.4443003

Description

Getting error as
undefined is not a function (evaluating 'reactDevTools.connectToDevTools')

C:\Users\Yajana\React-Native\fr-react-native\FrReactNative\node_modules\react-native\Libraries\Core\Devtools\setupDevtools.js:50:36
loadModuleImplementation
C:\Users\Yajana\React-Native\fr-react-native\FrReactNative\node_modules\metro\src\lib\polyfills\require.js:320:6
guardedLoadModule
C:\Users\Yajana\React-Native\fr-react-native\FrReactNative\node_modules\metro\src\lib\polyfills\require.js:214:36
metroRequire
C:\Users\Yajana\React-Native\fr-react-native\FrReactNative\node_modules\metro\src\lib\polyfills\require.js:136:24

C:\Users\Yajana\React-Native\fr-react-native\FrReactNative\node_modules\react-native\Libraries\Core\InitializeCore.js:211:13
loadModuleImplementation
C:\Users\Yajana\React-Native\fr-react-native\FrReactNative\node_modules\metro\src\lib\polyfills\require.js:320:6
guardedLoadModule
C:\Users\Yajana\React-Native\fr-react-native\FrReactNative\node_modules\metro\src\lib\polyfills\require.js:207:45
metroRequire
C:\Users\Yajana\React-Native\fr-react-native\FrReactNative\node_modules\metro\src\lib\polyfills\require.js:136:24
global code

Error Screenshot

@TheSixer
Copy link

TheSixer commented Jan 4, 2019

+1

@react-native-bot react-native-bot added the Platform: Android Android applications. label Jan 4, 2019
@ieniegg
Copy link

ieniegg commented Jan 4, 2019

+1

@aathapa
Copy link

aathapa commented Jan 4, 2019

#22863

@thaopit1992
Copy link

thaopit1992 commented Jan 4, 2019

run after when create project
yarn add eslint-config-rallycoding --dev

@bbeckk
Copy link

bbeckk commented Jan 4, 2019

+1

1 similar comment
@Xifeat
Copy link

Xifeat commented Jan 4, 2019

+1

@antoniomarcosferreira
Copy link

Thanks, @Aayush-dev, #22863 This work for me!

@decisionnguyen
Copy link

+1

@ghost
Copy link
Author

ghost commented Jan 4, 2019

npm install --save-dev [email protected] Resolved the issue

@ghost ghost closed this as completed Jan 4, 2019
@razerduy
Copy link

razerduy commented Jan 4, 2019

{
"name": "JWallet",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"i": "rm -rf node_modules yarn.lock && yarn install",
"run:devTools": "react-devtools",
"bundle:ios": "rm -rf ./ios/REPatient/main.jsbundle && react-native bundle --entry-file='index.js' --bundle-output='./ios/JWallet/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'",
"run:ios": "react-native run-ios"
},
"dependencies": {
"react": "16.6.3",
"react-native": "0.57.8"
},
"devDependencies": {
"babel-jest": "23.6.0",
"eslint-config-rallycoding": "^3.2.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.51.1",
"react-devtools-core": "3.4.2",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}

Still error

@shravanteegala
Copy link

i resolved using below command
npm install --save-dev [email protected] Resolved the issue

@gabryelferreira
Copy link

+1

@bhavu43
Copy link

bhavu43 commented Jan 4, 2019

npm install --save-dev [email protected] → Works

@akiladevinda
Copy link

This will work
npm install --save-dev [email protected]

or try to remove node_modules folder and re-install it using 'npm install --save'

@charlesnse
Copy link

npm install --save-dev [email protected]

then also run react-native run-android

works perfectly for me

@tomm1996
Copy link

tomm1996 commented Jan 4, 2019

Can anyone explain why installing react-devtools-core will fix the issue?

@sachinkodkani
Copy link

thanks @yajan
installation of react devtools core solved my issue!

@jasonroyle
Copy link

Can anyone explain why installing react-devtools-core will fix the issue?

More info at #22863

@tpmpb
Copy link

tpmpb commented Jan 4, 2019

npm install --save-dev [email protected] Resolved the issue

Unfortunately didn't work :'(

@jasonroyle
Copy link

jasonroyle commented Jan 4, 2019

I am running...

react-native: 0.57.8
react-native-cli: 2.0.1
yarn: 1.12.3

I needed to add a resolution to package.json...

{
  ...
  "resolutions": {
    "react-devtools-core": "3.4.3"
  }
}

Then run...

$ yarn
$ yarn start --reset-cache

@atrauzzi
Copy link

atrauzzi commented Jan 4, 2019

If you're running the current version of react-native, react-devtools-core 3.5.x is a transitive dependency and as a result npm/yarn install will result in react-native having its own copy at that version. Even despite whether you specify 3.4.x in your own package.json.

If you're using yarn, you can tell it to flatten your dependency tree and then manually force it to resolve the older version for the single copy it installs.

Be warned, this is also going to result in it prompting you for every shared dependency in your project, although personally, I like this for several reasons... ☺️

@danielfssz
Copy link

+1

@danielfssz
Copy link

danielfssz commented Jan 4, 2019

i resolved using below command
npm install --save-dev [email protected] Resolved the issue

  • npm install

solved for me

@tpmpb
Copy link

tpmpb commented Jan 4, 2019

I am running...

react-native: 0.57.8
react-native-cli: 2.0.1
yarn: 1.12.3

I needed to add a resolution to package.json...

{
  ...
  "resolutions": {
    "react-devtools-core": "3.4.3"
  }
}

Then run...

$ yarn
$ yarn start --reset-cache

THAAANK YOU, BUDDY

@facebook facebook locked as resolved and limited conversation to collaborators Jan 4, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jan 4, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests