Description
Description
The last couple of days I've been attempting to debug the current React Native master (updated the HEAD a few times) on either iOS or Android, however app execution fails immediately after receiving the bundle with the exception:
undefined is not an object (evaluating 'ReactInternals.ReactCurrentOwner')
I've attempted clean app rebuilds many times:
watchman watch-del-all
rm -rf ./node_modules
yarn cache clean
rm -rf $TMPDIR/react-*
yarn install
npm start -- --reset-cache
Also, cleaned the Android builds (./gradlew clean
) and iOS builds ("Clean" and "Clean Build Folder") and rebuilt.
Reproduction Steps and Sample Code
-
Check out RN master.
-
Build the Android libs using:
./gradlew installArchives
-
Check in the resultant
android/
directory (force add as it's.gitignore
'd) and push to a Github branch. -
In a RN app swap from the NPM published package to the published branch e.g.
yarn remove react-native
yarn add github:benjamin-dobell/react-native#builds/dynamic-toolbar
-
Rebuild the app
cd android; ./gradlew clean; ./gradlew installDebug
, or for iOS from XCode. -
Launch the RN packager:
yarn start
Note: If you haven't grabbed flowtype from master this will fail here. I just temporarily replaced the spread operator usage in type definitions with copy and paste contents.
- Launch the app on an Android or iOS device. Wait for the packager to bundle the package.
Error then occurs.
It's perhaps worth noting that, I believe, this is the exact procedure I've followed in the past to build and test (and eventually contribute back) my RN forks.
Solution
Unsure.
Additional Information
- React Native version: 73fc439
- Platform: Android & iOS
- Development Operating System: macOS 10.12.4 (16E195)
- Dev tools:
- android-ndk-r10e
- Xcode 8.3.2 (Build version 8E2002)
- node v7.9.0
- yarn 0.23.4
- npm 4.2.0
Activity
Benjamin-Dobell commentedon May 9, 2017
It doesn't seem obviously related to me, but perhaps a hint toward the underlying cause. When you run the packager with:
instead of simply
yarn start
.You end up with a few warnings about duplicate modules:
Benjamin-Dobell commentedon May 9, 2017
Full trace (from iOS):
Benjamin-Dobell commentedon May 9, 2017
I could have sworn I updated my React peer dependency. Apparently not!
That was the cause. Sorry!
A note to anyone else trying to run RN from master. Double check the react version in RN's
package.json
matches the one in your app's yarn lockfile.winterrain5 commentedon Jun 9, 2017
i have the same problem in the ios,is there anybody solved it?
Benjamin-Dobell commentedon Jun 9, 2017
@winterrain5 As I mentioned, make sure you've installed the correct version of React. If you're using React Native 0.45:
deathnopool commentedon Jun 9, 2017
i got the same problem after upgrading to 0.45
rclai commentedon Jun 10, 2017
I'm assuming that you also need to update this too if you have it?
Liqiankun commentedon Jun 12, 2017
@Benjamin-Dobell Thank you !
joimxjtuse commentedon Jun 22, 2017
i have the same question in my android project. how to fix it ? i, package.json:
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.45.1"
}
shenxiaolin commentedon Jul 6, 2017
Hi
Same problem like above
My package.json
"name": "RNDemo",
"version": "1.0.0",
"description": "",
"main": "index.android.js",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^15.6.1",
"react-native": "^0.46.0"
}
How to fixed it ??
rajsuvariya commentedon Jul 10, 2017
@Benjamin-Dobell It worked. Thanks.
simonbengtsson commentedon Jul 29, 2017
Hmm. I'm getting the same message with
react-native: 0.46.0
andreact: 16.0.0-alpha.12
. Probably me doing something stupid on my machine though as I get the same issue no matter what react native example I'm running.EDIT: My issue was that I did not move the ios project to an
ios
sub folder.sayanibhattacharjee commentedon Aug 4, 2017
This is my
package.json
. Is there any workaround?{ "name": "NowPurchase", "version": "0.1.0", "private": true, "devDependencies": { "react-native-scripts": "0.0.50", "jest-expo": "~18.0.0", "react-test-renderer": "16.0.0-alpha.12" }, "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js", "scripts": { "start": "react-native-scripts start", "eject": "react-native-scripts eject", "android": "react-native-scripts android", "ios": "react-native-scripts ios", "test": "node node_modules/jest/bin/jest.js --watch" }, "jest": { "preset": "jest-expo" }, "dependencies": { "expo": "^18.0.3", "react": "16.0.0-alpha.12", "react-native": "^0.45.1", "react-native-collapsing-toolbar": "^1.0.0-beta.4", "react-native-drawer-menu": "^0.2.4", "react-native-keyboard-aware-scroll-view": "^0.2.9", "react-native-material-design": "^0.3.7", "react-native-util": "^1.0.2", "react-native-vector-icons": "^4.3.0", "react-navigation": "^1.0.0-beta.11", "util": "*" } }
tiofabby commentedon Aug 8, 2017
Hello
I had same issue when migrating from recat native 0.42.1 to 0.47.0
I did the following and it fixed almost all my issues :
(some react native libraries I had had to be updated also to last version supporting 0.47)
sayanibhattacharjee commentedon Aug 8, 2017
Thanks! Resolved it!
av1v3k commentedon Aug 9, 2017
followed @tiofabby @saayani But, NOT WORKING.
package.json configuration is as below.
av1v3k commentedon Aug 19, 2017
OK. I got it resolved by doing the things below.
Problem Solved ! @tiofabby @saayani 👍
LinkRober commentedon Aug 23, 2017
@tiofabby it works for me ,i used
iegik commentedon Aug 31, 2017
@LinkRober #15621
yudiandian commentedon Oct 13, 2017
解决方法:把react,react-native安装如下版本就好了
"react": "^16.0.0-alpha.12",
"react-native": "^0.46.4",
koliatest commentedon Oct 30, 2017
解决方法:把react,react-native安装如下版本就好了
What...?
dienast commentedon Dec 18, 2017
I removed the '^' in front of "16.0.0-alpha.12" and it worked.
tetogomez commentedon Feb 6, 2018
Yep I added react@16.0.0-alpha.12 and it worked for me.
you guys saved my life hahaha thks !!
tintorres commentedon Mar 20, 2018
react@16.0.0-alpha.12 worked for me too. thanks