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

Can't run the project after upgrading to 0.26 #7679

Closed
cubbuk opened this issue May 22, 2016 · 22 comments
Closed

Can't run the project after upgrading to 0.26 #7679

cubbuk opened this issue May 22, 2016 · 22 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@cubbuk
Copy link

cubbuk commented May 22, 2016

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

@dattran92
Copy link

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';

@pewh
Copy link

pewh commented May 23, 2016

+1 already migrate like that but still encounter same issue

@MichaelDanielTom
Copy link

@cubbuk @pewh I got the same error when I had react@15.1.0 after upgrading to react-native@0.26.1. Downgrading to react@15.0.2 solved my problem.

@cubbuk
Copy link
Author

cubbuk commented May 23, 2016

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?

@rushabh1191
Copy link

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

@KevinHu2014
Copy link

KevinHu2014 commented May 23, 2016

Same problem while upgrading to 0.26

@cubbuk
Copy link
Author

cubbuk commented May 23, 2016

@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

@KevinHu2014
Copy link

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

@cubbuk
Copy link
Author

cubbuk commented May 23, 2016

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.

@pewh
Copy link

pewh commented May 23, 2016

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.

@digitalcatnip
Copy link

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.

@rushabh1191
Copy link

rushabh1191 commented May 24, 2016

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

@aprct
Copy link

aprct commented May 24, 2016

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

@duketwo
Copy link

duketwo commented May 25, 2016

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

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

@pewh
Copy link

pewh commented May 25, 2016

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.

@TitleZWC
Copy link

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.

@podybman
Copy link

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

@podybman
Copy link

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

@kkgelu
Copy link

kkgelu commented Jun 29, 2016

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..

@saurshaz
Copy link

@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.

@saurshaz
Copy link

saurshaz commented Jul 10, 2016

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.

@mkonicek
Copy link
Contributor

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.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 19, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
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