Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running into 'Cannot read property 'ReactCurrentOwner' of undefined' after installing packages

Tags:

react-native

I run into the following error in ReactNative on app launch:

Cannot read property 'ReactCurrentOwner' of undefined

This usually happens after installing a new package or switching branches on my project with different sets of packages installed.

I'm can resolve it by running react-native-git-upgrade but this does not seem like a real solution.

Any ideas what can cause this error and how to avoid it?

like image 582
Christoph Avatar asked Jun 23 '17 08:06

Christoph


1 Answers

was having the same issue and as you say, it's a version compatibility problem in react and react-native. Would also affect expo if you're using that.

React + React-native have to use specific versions that work with each other.

The react-community org on Github provides a table that helped me install the correct versions. Here are a few examples from that document:

Note that I did npm install --save react@<correct version>

Then rm -rf node_modules && npm install

And lastly: npm start --reset-cache

My app runs again!

like image 141
alphanumeric0101 Avatar answered Nov 13 '22 17:11

alphanumeric0101