react-native: undefined is not a function(evaluating '_this.registerEvents()')

Environment

React Native Environment Info:
    System:
      OS: Windows 10
      CPU: x64 Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz
      Memory: 757.11 MB / 7.93 GB
    Binaries:
      Yarn: 1.9.4 - C:\Users\ecumb\AppData\Roaming\npm\yarn.CMD
      npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
    IDEs:
      Android Studio: Version  3.1.0.0 AI-173.4907809

Description

reproerror

Reproducible Demo

Create RN project using react-native init using version 0.57.0-rc0 react-native run-android kill the spawned bundler and relaunch using npm start to work around issue #20712

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 47 (13 by maintainers)

Most upvoted comments

Seems like rc-3 solves the issue

I have this exact error.

Worth mentioning that it’s because i’m on 57-rc0 to escape the acessiblity bug in 56

Also worth mentioning that I’m here because 56 is the default configuration in webstorm.

Whats a stable version of react-native I can use to learn things?

Looks resolved.

I’m having this issue on any project with 0.57 rc3, starting from scratch or upgrading. I’m using macOS Mojave beta.

I do have this problem with rc2 (on macOS)

@haggholm had this issue undefined is not a function(evaluating '_this.registerEvents()') on 0.57.0-rc.2 but now with the configuration in .babelrc and 0.57.0-rc.4 it works.

I can confirm that this works with the latest 0.57 rc4:

package.json

    "@babel/cli": "^7.0.0",
    "@babel/core": "^7.0.0",
    "metro-react-native-babel-preset": "^0.45.1",

.babelrc

"presets": ["module:metro-react-native-babel-preset"]

I can also confirm some of @donjo9’s process. Here is what got me from a clean git repo to a working app:

  1. Update Android SDK Build-Tools via Android SDK Manager
  2. react-native init MyApp2 --template typescript --version 0.57.0-rc.3
  3. cd MyApp2
  4. react-native upgrade
  5. Answer “y” to all questions
  6. Point genymotion Android SDK to folder location for my Windows user (genymotion > Setting > ADB)
  7. Restart computer
  8. Open genymotion emulator (Samsung GS8 API 26)
  9. react-native run-android

At this point the bundler booted up, the app installed on the emulator, and I was able to debug via chrome dev tools. I will update this later tonight when I can test on a different computer.

Sorry for keep spamming, but this got me from a clean git clone to a working app git clone https://github.com/joejordan/0.57rc3-WindowsCrash Test057rc3 cd Test057rc3 npm install react-native upgrade answering y to every question Install

platforms;android-27 Android SDK Platform 27
build-tools;27.0.3 Android SDK Build-Tools 27.0.3

with the Android SDK manager react-native run-android this will still fail kill bundler react-native start --reset-cache

From this point on react-native run-android should work

@joejordan Your .babelrc is wrong. If you have other questions, please try create a new project and make some diff in case you miss something. It should be:

{
  "presets": ["module:metro-react-native-babel-preset"]
}

Try deleting node_modules/.cache, and then doing react-native start --resetCache

Is this still a problem with rc2 ? because i used to have this issue, but dont with rc2

React Native Environment Info:
    System:
      OS: Windows 7
      CPU: x64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
      Memory: 1.09 GB / 11.92 GB
    Binaries:
      Yarn: 1.9.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
      npm: 6.1.0 - C:\Program Files\nodejs\npm.CMD
    IDEs:
      Android Studio: Version  1.5.0.0 AI-141.2456560