After a fresh install of react native the following error appears on screen:
+1
same issue on run-android
win7
same here
react native 0.44.0
macOS 10.12 Sierra
xcode 8.3.2
The error does not show up when building "Release" on a device, only "Debug".
+1
Sounds strange, but doesnt happen for me.
I use Dimensions lib and it runs just fine over couple of RN releases right from 0.39 up to 0.44.
Is it possible that any of you are using NavigationExperimental
in your app? This module was removed in 0.44 and can cause this error if your app tries to require it.
@rawrmaan This happens on a fresh install.
@rawrmaan Not quite
in my case fresh app is working good,
i just installed "react-native-router-flux" with npm (so probably you are right)
just for Navigation issue:
https://github.com/aksonov/react-native-router-flux/issues/1832
Try closing terminal, deleting ios/build and run again. I had the same issue but now its working.
try importing StaticContainer from react native
For the case of android, try close terminal, run npm cache clean
and then by using new react-native-cli, which I removed react-native-cli from 0.42, and installed react-native-cli for 0.44, then run react-native run-android
, worked for me.
+1 Same issues. Fresh install.
iOS
I had the same error on a brand new project. Turned out I had an old Package Manager running from a different project. Once I closed that, the fresh app worked after running react-native run-ios
again.
Same issue. Got it on Android
Just close terminal, open a new one, run npm cache clean, and run your project again. Boom, done!
Update 05/22/17: Turns out the underlying issue here for us was we were running 2 different versions of React Native... An included gradle dependancy was bumping our RN version up and our bundle was expecting a lower version.
On Android it seems to be an issue with using React Native v0.44.0 along with Android SDK Build Tools version 25.
If you downgrade to React Native 0.43.2 the issue goes away or alternatively if you downgrade your Android compileSdkVersion
to 23 (and buildToolsVersion
to 23.0.1) the issue also goes away.
Fix 1
In your app build.gradle
change compile "com.facebook.react:react-native:+"
to compile "com.facebook.react:react-native:0.43.2@aar"
OR
Fix 2
In your app build.gradle
downgrade your SDK to target and compile against 23
compileSdkVersion 23
buildToolsVersion "23.0.1"
...
targetSdkVersion 23
...
compile "com.android.support:appcompat-v7:23.0.1"
We're seeing this on Android and our buildToolsVersion
is 23.0.1
and our compileSdkVersion
is 23
.
Got same issue with fresh install on android. I closed the old Package Manager running from a different project and it worked.
After reading all the commentaries I and trying different solutions, I got this 5 points. Maybe they are helpful for someone else.
1) The fresh app worked for me;
2) After installing react-native-router-flux, the issue came out - like @andrii-yarmola said;
3) I had others projects on the same machine - with different library versions. But the solution given by @rkbhochalya and @mattdufeu did not work for me;
4) It happened with iOS and Android;
4) Only after rebooting the machine - MacOSX - the issue was gone.
You can also try clearing cache:
watchman watch-del-all && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
or if you have yarn installed:
watchman watch-del-all && rm -rf node_modules/ && npm cache clean && yarn install && npm start -- --reset-cache
Also close all package manager terminal windows running from different projects.
@rkbhochalya clearing cache resolves. thanks.
Same issue at fresh project.Closing terminal and clearing cache didnt work.I am totally stuck.target sdk 22
I
I get the same error on Android 6 with React Native v0.44.0,I downgrade RN version to v0.43.0, it is work.
@rkbhochalya clearing cache also resolves. thanks!
npm start -- --reset-cache
was working for me!
@NickJorgensen Have you worked out any approach to solve the problem? Only when release can have this mistake
@rkbhochalya Only when release can have this mistake Can you solve it
+1 Same error
I had the same problem but thanks to the comments I managed to solve it.
I upgraded to:
"react": "16.0.0-alpha.6",
"react-native": "0.44.2",
After that:
rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean
rm -rf node_modules
npm install
That solved it.
+1
This is a pain.
+1
on device all fine
on emulator same error
+1
Deleting watchman cache and reinstalling node modules still does not fix the error for me
Update:
After running react-native upgrade
, setting new versions of react and react-native, and updating the rest of my dependencies, I was able to resolve this and other errors. I realize this will not solve everyone's issue, but figured it would be worth it to post.
Here's some of the versions for my packages.
node v7.10.0 was working for me, but node v8.0.0+ was not.
Just running react-native upgrade
fixed it for me
I got this problem again, but this time
rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean
rm -rf node_modules
npm install
didn't help.
After a while the project started again, but I have no idea of why!
I run into this on iOS, when I switched react native versions. I think it happens due to stale react native binaries. Cleaning the project and running the build in Xcode solved it for me.
Close all terminal
run npm cache clean
and after you can run your project with react-native run-ios
worked for me
For the case of android, try close terminal,then run react-native run-android, worked for me.
if you got issue with Debug build, you can fix it as above.
if you got issue with Release build, you need regenerate main.jsbundle
by react-native bundle --minify --dev false --assets-dest ./ios --entry-file index.ios.js --platform ios --bundle-output ios/main.jsbundle
.
I'm getting this on 0.49.0 in iOS but only in the Release build. Appears to be a timing issue as it happens randomly. Any work-around on this?
//edit Running react-native-git-upgrade
did it for me. Great work on that one!
Mine is solved after downgrading npm from @5 to @4.6.1
If none of the above solutions helped, it could be that you misspelt window with a capital W. It should in all lower case letters.
Most helpful comment
Try closing terminal, deleting ios/build and run again. I had the same issue but now its working.