react-native: Can't run the project after upgrading to 0.26

After upgrading react native to 0.26.1 I started getting the following error for an adroid project running on Ubuntu:

undefined is not a function (evaluating 'RCTEventEmitter.register(ReactNativeEventEmitter)')
Module AppRegistry is not a registered callable module.

If I try to run using emulator I get the following error:

05-22 15:19:13.550  1668  1724 E ReactNativeJS: undefined is not an object (evaluating    'ReactPerf().injection.injectMeasure')
05-22 15:19:13.569  1668  1724 E ReactNativeJS: Requiring module "313", which threw an exception.
05-22 15:19:13.573  1668  1724 E ReactNativeJS: Module AppRegistry is not a registered callable module.

I followed the tips on the following issue #7336 and upgraded react to 15.0.2 but didn’t help me either. Are there anyone who encountered this error?

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 22 (1 by maintainers)

Most upvoted comments

It seems we need to downgrade to previous version and fix all ‘deprecated’ warning.

So I downgrade to RN 0.25, run it, and get yellow-box error ‘Warning: ReactNative.XX is deprecated. Use React.XX from “react” package instead’. I have make sure my codebase have been migrated like @cubbuk said. I guess there are some packages in node_modules still access PropTypes and Component from react-native.

Yellow-box error just show warning message. I really confused what’s file I need to be fixed. And it’s VERY difficult to check 100++ folders in node_modules and manually edit those one-by-one. Upgrade all packages didn’t resolve an issue if some packages still not change codebase.

In my case it was because of the breaking change of react-nativenot shipping the React specific parts within it starting v0.26.x. So instead of import React, {Component, PropTypes, View Text, StyleSheet} from react-native I had to do import React, {Component, PropTypes} from react import {View Text, StyleSheet} from react-native

That shall be change you shall be able to find-replace in all your components in the codebase. also, all node_modules can be upgraded to their latest version that supports RN v0.26.x or do away with those that have not updated.