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

Created on 22 May 2016  路  22Comments  路  Source: facebook/react-native

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

Locked

Most helpful comment

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.

All 22 comments

Please check if your Component is imported from 'react-native' or 'react' package.
For the new version. It should be:
import React, { Component, } from 'react';

+1 already migrate like that but still encounter same issue

@cubbuk @pewh I got the same error when I had [email protected] after upgrading to [email protected]. Downgrading to [email protected] solved my problem.

Thanks for the guidance. As @dattran92 and @MichaelDanielTom mentioned changing react version to 15.02 and importing React and Component from react helped (PropTypes should also be imported from react package). I also needed to deleted the node_modules and install it again.

Thing is I am using some dependencies which are not compatible with 15.02, is there any way to make them work with older version of react, while using 15.02 in my project?

I am getting same error after upgrding 0.26 . Did anybody solve the error?

Same problem while upgrading to 0.26

@rushabh1191 @KevinHu2014 did you start importing React from react rather than react-native? And in your package.json, don't forget to upgrade react to 15.02

@cubbuk yes, I import React from react and upgrade react to 15.02 but still have the same problem

I had to delete the node_modules and install dependencies once again to make it work. Could you check in your codebase that you don't access PropTypes and Component from react-native package, they should also be imported from react package.

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.

Is it possible to get some kind of error dump? After upgrading to 0.26.1 now my app crashes immediately with:

2016-05-23 18:44:27.591 [error][tid:com.facebook.react.JavaScript] Requiring module "183", which threw an exception.
2016-05-23 18:44:27.593 PredElection[69367:841415] -[RCTRootView reactTag]: unrecognized selector sent to instance 0x7fee0ae17550

Googling SO tells me it means there's an error in my bundle, but I have no idea what it is because the app immediately crashes.

I've literally spent about 6 hours upgrading React today from 0.24 to 0.26.1. What a PIA this is.

@cubbuk yes. I did that. #7697 helped me to solve the issue.

I'm having the same problem, but with a different cause: #7722

Search in node_modules and in your app-source folder for Component, PropType imports from react-native.

Regex: [}](?s:.)*PropTypes(?s:.)*(react-native(.);)

Thanks for the trick, @duketwo! It should work on some case. I have trying search file content using your Regex pattern by Sublime Text (of course I enable Regex pattern), but nothing.

FYI, I have inspect some files on node_modules, and got something like this:

var React = require('react-native')
...
class X extends React.Component { ... }

So, it's hard to detect by using Regex pattern.

PS: Does anyone know how to force yellow-box to assume as red-box? I think I can get related files by seeing stack trace on red-box error.

Same problem while upgrading to 0.26.I upgrade the version the yesterday, it works normally .But this problem happened just now. I don't know why.

I'm having the same issue but with the Getting Started project and a brand new 0.26 installation.

Looks like something like npm install solved this. I'm clear now.

Why couldn't RN tell exactly which file(s) caused this error. In my case, after all the migration, I got:
undefined is not an object (evaluating 'React.PropTypes.oneOf')

I guess it's some dependencies not compatible with new version of RN, but it's hard for me to pin point which one..

@kkgelu enabling debug mode will give you more information. But I'm struggling with what next ?
I think it was a wise decision to be on a newer version at start of the project. But am also facing this.

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.

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/cant-run-the-project-after-upgrading-to-026

Product Pains has been very useful in highlighting the top bugs and feature requests:
https://productpains.com/product/react-native?tab=top

Also, if this issue is a bug, please consider sending a pull request with a fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Findiglay picture Findiglay  路  239Comments

michalraska picture michalraska  路  223Comments

soutot picture soutot  路  192Comments

PhillippOhlandt picture PhillippOhlandt  路  321Comments

abumostafa picture abumostafa  路  263Comments