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

[0.57] _this._registerEvents is not a function on a clean project #21094

Closed
3 tasks done
mgcrea opened this issue Sep 13, 2018 · 25 comments
Closed
3 tasks done

[0.57] _this._registerEvents is not a function on a clean project #21094

mgcrea opened this issue Sep 13, 2018 · 25 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@mgcrea
Copy link

mgcrea commented Sep 13, 2018

Environment

$ react-native info

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
      Memory: 520.12 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
      Yarn: 1.9.4 - /usr/local/bin/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
    IDEs:
      Xcode: 10.0/10L232m - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.0 => 16.5.0 
      react-native: 0.57.0 => 0.57.0 
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1

Description

Bumped an existing 0.56.1 project to 0.57 and encountered an error on simulator start: _this._registerEvents is not a function on a clean project. Tried a new project from scratch and got the same error. Running Xcode 10 Beta.

Same error was mentioned in the following ticket: #20712

screen shot 2018-09-13 at 12 21 14

_this._registerEvents is not a function. (In '_this._registerEvents()', '_this._registerEvents' is undefined)

WebSocket
    index.bundle?platform=ios&dev=true&minify=false:24147:28
connectToDevTools
    index.bundle?platform=ios&dev=true&minify=false:26078:62
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:25863:38
loadModuleImplementation
    index.bundle?platform=ios&dev=true&minify=false:262:14
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:19771:20
loadModuleImplementation
    index.bundle?platform=ios&dev=true&minify=false:262:14
guardedLoadModule
    index.bundle?platform=ios&dev=true&minify=false:150:47
global code
    index.bundle?platform=ios&dev=true&minify=false:81797:4
****

Reproducible Demo

xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
react-native init AwesomeProject
cd AwesomeProject
node_modules/.bin/react-native run-ios

EDIT: Tried another new project and it worked this time. I guess it must be related to caching issues.

Will reopen if I can reliably reproduce.

@mgcrea mgcrea changed the title 0.57 - _this._registerEvents is not a function on a clean project [RN 0.57] _this._registerEvents is not a function on a clean project Sep 13, 2018
@mgcrea mgcrea changed the title [RN 0.57] _this._registerEvents is not a function on a clean project [0.57] _this._registerEvents is not a function on a clean project Sep 13, 2018
@mgcrea mgcrea closed this as completed Sep 13, 2018
@eggybot
Copy link

eggybot commented Sep 14, 2018

got the same issue.

@onmyway133
Copy link

onmyway133 commented Sep 17, 2018

I got this issue on a clean new project as well. Currently I need to fallback to 0.56.0 to continue

@hbicexp
Copy link

hbicexp commented Sep 18, 2018

#20567 by kelset

  1. add the metro-react-native-babel-preset package
  2. change .babelrc to
    {
    "presets": ["module:metro-react-native-babel-preset"]
    }
  3. npm run start --reset-cache
    or
    react-native start -reset-cache

@chc200
Copy link

chc200 commented Nov 3, 2018

react-native start --reset-cache worked for me on @hbicexp solution

@abrarum
Copy link

abrarum commented Nov 4, 2018

Same error..

@jankeesvw
Copy link

We updated to React Native 0.57.4 and @babel/core 7.1.2 and our problem went away.

@svenjens
Copy link

svenjens commented Nov 8, 2018

Updating to React Native 0.57.4 and @babel/core 7.1.2 did not solve it for me.

@jeremyblalock
Copy link

Clean install doing nothing but react-native init RNTestProject produces this same error for me still.

@diego-lipinski-de-castro

still a problem

@bwoodlt
Copy link

bwoodlt commented Nov 25, 2018

having the same issue after changing to apollo client 2.0

@waltChang1
Copy link

same error
_20181218155733

@ricardodrs
Copy link

Any solution for this issue? Nothing work for me :/

@aligenc
Copy link

aligenc commented Jan 24, 2019

it has been 1,5 year that I am coding with react-native. what i learned in this long time.

  1. dont touch your released code
  2. never mind doing something new

'cause all I have is these fc.g bugs with no solution.

@ShooterArk
Copy link

Did anyone found a solution for this? I am facing the issue for a while now! Cant make new projects cause they show the same error.. :/

@mzxyz
Copy link

mzxyz commented Feb 18, 2019

@ShooterArk my react-native version is "0.58.4". The following steps fix my issue:

  1. Delete the app, and use the clean the builder folder on Xcode.
  2. Close Metro Bundler and use the Xcode to rebuild the app,
  3. If still not working, try to run react-native start -reset-cache or yarn start -reset-cache -> yarn start then reload the app on client side.

Hope this can fix your issue

@ShooterArk
Copy link

@huanday I need to execute it on Android emulator!! I have already tried multiple times: react-native start -- --reset-cache.

@Shabnam-Veranloo
Copy link

my react-native version is "0.59.4" and have same issue

@ptmt
Copy link
Contributor

ptmt commented Apr 14, 2019

Try commenting out setupDevtools in setUpDeveloperTools. I still haven't found the underlying issue, but since all I want to upgrade my old project, I will postpone the investigation.

@SourceCipher
Copy link

Why is this closed when the referred post has no solution apart saying to piss off and create a new project? I spent entire weekend trying to upgrade some libraries and its been a nightmare.. What a waste of time..

Now finally my project builds up and starts, but upon starting I have this issue as well.. I probably going to give up and just use ancient configs.. At least it works rather than stay up to date and have a pile of errors

@MrShakes
Copy link

MrShakes commented Jun 2, 2019

After following @hbicexp 's instructions I had to restart my system to get it working/truly clear the cache(was still getting errors otherwise)

@parasbansal
Copy link

I had the same problem. I did the following and now it works fine:

  1. watchman watch-del-all
  2. rm -rf node_modules/.cache
  3. react-native start --reset-cache
  4. To be absolutely sure:
    a. Uninstall the app from emulator/device.
    b. Restart the system

@parasbansal
Copy link

parasbansal commented Jun 24, 2019

Never mind. The problem was fixed but after about 30 mins it's back and this time the above solution is not working.
I even tried gradlew clean and npm cache clean.

Update:
I removed everything from .babelrc and left an empty object and now the app works perfectly.
Even after ~1.8 years of development in react-native, I have no idea about what is going on. :\

@Subway19
Copy link

Subway19 commented Jul 15, 2019

Facing the same issue.

Requiring module "node_modules/react-native/Libraries/Core/InitializeCore.js", which threw an exception: TypeError: _this._registerEvents is not a function

Tried all the methods mentioned above. This is the output of my react-native info


  React Native Environment Info:
    System:
      OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
      CPU: (4) x64 Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
      Memory: 330.08 MB / 7.69 GB
      Shell: 4.4.19 - /bin/bash
    Binaries:
      Node: 8.3.0 - ~/.nvm/versions/node/v8.3.0/bin/node
      npm: 5.3.0 - ~/.nvm/versions/node/v8.3.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      Android SDK:
        API Levels: 23, 25, 26, 27, 28
        Build Tools: 23.0.1, 24.0.1, 26.0.3, 27.0.3, 28.0.2, 28.0.3
        System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64
    npmPackages:
      react: ^16.8.3 => 16.8.6 
      react-native: ^0.59.10 => 0.59.10 

package.json


{
  "name": "testApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "react-devtools": "react-devtools"
  },
  "rnpm": {
    "assets": [
      "./App/assets/fonts"
    ]
  },
  "dependencies": {
    "adm-zip": "^0.4.11",
    "axios": "^0.17.0",
    "bugsnag-react-native": "^2.22.0",
    "clevertap-react-native": "^0.3.0",
    "js-file-download": "^0.4.1",
    "json5": "^2.1.0",
    "lodash": "^4.17.11",
    "moment": "^2.22.2",
    "native-base": "^2.7.2",
    "plist": "^3.0.1",
    "prop-types": "^15.7.2",
    "query-string": "^6.1.0",
    "react": "^16.8.3",
    "react-file-download": "^0.3.5",
    "react-moment": "^0.6.9",
    "react-native": "^0.59.10",
    "react-native-appsflyer": "1.2.13",
    "react-native-blur": "^3.2.2",
    "react-native-check-box": "^2.1.3",
    "react-native-checkbox": "^2.0.0",
    "react-native-code-push": "^5.6.0",
    "react-native-contacts": "^4.0.0",
    "react-native-cookies": "^3.3.0",
    "react-native-datepicker": "^1.7.2",
    "react-native-document-picker": "^2.1.0",
    "react-native-easy-grid": "^0.2.0",
    "react-native-email-link": "^1.1.0",
    "react-native-exception-handler": "^2.9.0",
    "react-native-extended-stylesheet": "^0.6.0",
    "react-native-fbsdk": "0.8.0",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-firebase": "^5.5.4",
    "react-native-flash-message": "^0.1.11",
    "react-native-google-signin": "^1.0.0-rc6",
    "react-native-htmlview": "^0.13.0",
    "react-native-icon-badge": "^1.1.3",
    "react-native-image-gallery": "^2.1.5",
    "react-native-image-picker": "^0.26.10",
    "react-native-image-preview": "^0.3.1",
    "react-native-image-zoom-viewer": "^2.2.15",
    "react-native-intercom": "^12.0.0",
    "react-native-linear-gradient": "2.4.0",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-mixpanel": "^1.1.1",
    "react-native-modal": "^6.5.0",
    "react-native-modal-selector": "^1.0.3",
    "react-native-modalbox": "^1.6.0",
    "react-native-month-selector": "^1.4.0",
    "react-native-picker-select": "^4.4.0",
    "react-native-prefix-picker": "^2.0.2",
    "react-native-progress": "^3.5.0",
    "react-native-prompt-android": "^0.3.4",
    "react-native-referrer": "^0.1.4",
    "react-native-restart": "0.0.6",
    "react-native-share": "^1.1.3",
    "react-native-signature-capture": "^0.4.9",
    "react-native-simple-radio-button": "^2.7.2",
    "react-native-slider": "^0.11.0",
    "react-native-star-rating": "^1.0.9",
    "react-native-svg": "^5.5.1",
    "react-native-svg-charts": "^2.2.3",
    "react-native-swiper": "^1.5.13",
    "react-native-switch": "^1.5.0",
    "react-native-theme": "^0.1.8",
    "react-native-timer-countdown": "^4.0.5",
    "react-native-vector-icons": "^4.6.0",
    "react-native-version-number": "^0.3.4",
    "react-navigation": "^1.5.13",
    "rn-fetch-blob": "^0.10.13",
    "rn-tooltip": "^1.1.2",
    "victory-native": "^0.15.0",
    "xcode": "^1.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.5.4",
    "@babel/runtime": "^7.5.4",
    "babel-jest": "20.0.3",
    "babel-loader": "^8.0.6",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "babel-preset-react-native": "^5.0.2",
    "jest": "20.0.4",
    "metro-react-native-babel-preset": "^0.55.0",
    "react-devtools": "^3.2.3",
    "react-test-renderer": "^16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

@StarkAndy
Copy link

Anybody got any solution yet !!

@GoldenMaximo
Copy link

GoldenMaximo commented Sep 3, 2019

I'm also facing this issue on version 0.60.5

Error screenshot

react-native info:

System:
    OS: Windows 10
    CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
    Memory: 1.10 GB / 7.88 GB
  Binaries:
    Node: 12.9.0 - C:\Users\GUSTAV~1.MAX\AppData\Local\Temp\yarn--1567529680393-0.3427366134530774\node.CMD
    Yarn: 1.17.3 - C:\Users\GUSTAV~1.MAX\AppData\Local\Temp\yarn--1567529680393-0.3427366134530774\yarn.CMD
    npm: 6.10.2 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    Android Studio: Version  3.5.0.0 AI-191.8026.42.35.5791312

package.json

{
  "name": "HomeDoctor",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.1",
    "axios": "^0.19.0",
    "babel-plugin-root-import": "^6.4.1",
    "react": "16.8.6",
    "react-native": "0.60.5",
    "react-native-dotenv": "^0.2.0",
    "react-native-gesture-handler": "^1.4.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-vector-icons": "^6.6.0",
    "react-native-xml2js": "^1.0.3",
    "react-navigation": "^3.12.1",
    "react-redux": "^7.1.1",
    "reactotron-react-native": "^3.6.5",
    "reactotron-redux": "^3.1.1",
    "reactotron-redux-saga": "^4.2.2",
    "redux": "^4.0.4",
    "redux-saga": "^1.0.5"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/runtime": "^7.5.5",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "babel-preset-react-native": "5.0.2",
    "eslint": "^6.2.2",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-test-renderer": "16.8.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

babel.config.js

module.exports = {
  presets: [
    'module:metro-react-native-babel-preset',
    'module:react-native-dotenv',
    'react-native',
  ],
};

I tried:
#21094 (comment)
#21094 (comment)
#21094 (comment)
None worked.

Solution:

I removed 'react-native' from my babel.config.js and added a parenthesis on the render of App.js instead of making it an object.

Changed it from:

const App = () => {
  <Provider store={store}>
    <Navigation />
  </Provider>;
};

to

const App = () => (
  <Provider store={store}>
    <Navigation />
  </Provider>
);

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

No branches or pull requests