Expo react-native app suddenly stuck on Splash Screen - ios

I've been building my expo app for a few months now - has always been working just fine.
I didn't touch it for 2/3 weeks and now, when I run expo start, my app gets stuck on the Splash Screen.
I managed to connect to react native debugger and I am getting this error:
Error: React Refresh runtime should not be included in the production bundle.
Error: Requiring module "node_modules/react-native/Libraries/Core/InitializeCore.js", which threw an exception: Error: React Refresh runtime should not be included in the production bundle.
Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
app.json and package.json can be found here
Another thing that might be helpful is that my App.tsx code doesn't even get reached (I have a couple of console logs that don't fire).
To anticipate some questions:
I'm not using preventAutoHideAsync(). In fact, I've stripped back the code to just display a single View in App.tsx
I haven't changed a single thing (didn't install new packages or change any code). This exact codebase run just fine two weeks ago
I've tried yarn cache clean, deleting node_modules and running yarn install, deleting .expo and .expo-shared folders, and updating to latest expo-cli version
I've tried running in both a real device and a simulator
Could anyone help diagnose this? Any advice is much appreciated

Related

Requiring unknown module "498" error in ReactNative getting started example

I'm trying to build and run an iOS simulator version of the getting started React Native project from the instructions at:
https://facebook.github.io/react-native/docs/getting-started.html
The app launches in the XCode simulator, displays it's window very briefly but then an exception occurs that opens a red screen with the message
"Requiring unknown module "498".If you are sure the module is there,
try restarting Metro Bundler. You may also want to run yarn, or npm
install (depending on your environment).
loadModuleImplementation require.js:176:29
viewPropTypes.js:15:30
loadModuleImplementation require.js:212:12
View.js:20:22
loadModuleImplementation require.js:212:12
AppContainer.js:22:13"
etc
Line 15 of ViewPropTypes is
const PlatformViewPropTypes = require('PlatformViewPropTypes');
Line 20 of node_modules/react_native/Libraries/Components/Views/View.js is
const ViewPropTypes = require('ViewPropTypes');
Note: There is another, 15 line View.js files in the directory structure at node_modules/react_native/lib/ it's basically a stub containing
// This is a forwarding module to allow React to require React Native internals
// as node dependency
module.exports = require('View');
I'm on the latest of everything, MacOS High Sierra (10.13.4), XCode 9.3 with 9.3 command line tools installed. I've tried running yarn and npm install, and a fresh install. Obviously I have NPM and Watchman installed. Any ideas why the stock example won't run for me?
Newbie mistake. I had previously attempted to build a different React Native project in a different directory, and Metro Bundler was still pointed at the previous project. As the error message suggested, restarting Metro Bundler fixed the problem.
Also didn't realize the errors in the exception screen were tappable, they take you right into the Metro Bundler terminal process for more detail. Hope this helps someone else too!
In my case, just close all the related process, and re-run react-native run-android solved the problem.
refer to: https://github.com/facebook/react-native/issues/11568
I had the same issue.
In my case, while creating a reusable component, I wasn't importing React into the file,as I was not using them(in functional component) in the component file.
Turns out that jsx to React Element conversion happens per file/module basis, so we should import React and component in every file.
Including Both React and Component normally, solved the problem.
For me I got "955" error. And a simple solution was to
import React, {Component} from "react";

ios Could not get BatchedBridge, make sure your bundle is packaged properly

I am getting this while running app on simulator using xCode, version 9.2
I've tried other solution mentioned on Stack overflow & Github S1S2 S3 S4 but most of the solution are mentioned for android.
P.S. This project also includes purescript code explained here Integrate Pure Script in your React Native project
That's how I resolved it.
Terminate your metro bundler > react-native link > react-native run-ios
It was not bundling because of some errors which was not showing in the simulator but just this error was thrown.
create index.js, index.android.js and index.ios.js whith the same content. I do have all of them and it solved my issue
I have also faced the same issue when I changed the name of images saved in my local directory. In my case, I have just restarted metro bundler, deleted the app, and restarted the app. Issue was fixed for me.
Try this:
npx react-native-asset
then:
react-native run-ios
This issue is caused basically when some packages or images are not bundled properly, it might be caused because of improper assets path or internet issue when installing packages or reload issue. The expo bundles into a standalone library so it can be available immediately.
This error does not provide any stack to debug since it does not properly have the bundled data even for error stack.
I have just face few bundled scenarios
Scenario 1 => While the expo is running and we install a new library on fly, few times during this importing the library might not get bundled properly, so it's better to stop the expo and re-run, or try reloading the error in app. This will some time resolve the issue, or if there is some error it will show up the error stack
Scenario 2 => You have a customised asset director or have changed the asset path in app.json file improperly.
Please let me know in comments if there are any other scenarios
I had a metro bundler terminal window opened and whenever I was running npm run ios , it wasn't starting a new metro server, the problem was that. I closed the metro bundler terminal window and ran npm run ios and it opened a started a new metro server and the error was gone
I had a same issue, then I did:
rm -rf node_modules,
npm install
and restarted the metro (npm start). It worked.
In Settings, go to Privacy > Local Network to see a list of every app that requested access. I solved by allowing my app to access to the local network. (Trying to run on physical iPhone device from my mac m1 on the same wifi).
Source
Make sure that when you restart the expo project you do so with expo start -c
-c throws out the cache, otherwise the problem persisted for me.

installReactHook is not a function / installReactHook is undefined

Suddenly I can't get my react native project to start on ios simulator or device. I don't know what happened in between. I tried to clear all cache, reinstalled the node modules, pod install, but nothing works. Can't find anything except that in the react native documentation that this is part of Systrace. I'm stumped.
I did run npm link yesterday - maybe it messed something up, but still after that building was not an issue.
I'm sure i messed something up myself, but hopefully someone has a hint.
Not sure this will help, but sometimes cleaning the ios build folder fixes weird things
This was a bit of a headache.
I also saw the error Module AppRegistry is not a registered callable module (calling runApplication). But that was not really the issue.
Whilst checking if android build has similar problem, I found that the module react-native-animated-linear-gradient had two issues
It gave problems with ReactNativeFeatureFlags.js.
It had a duplicate definition of react-native (as if it also included the whole react-native project through its package.json
By continuing to remove this package completely, unlinking it manually, reinstalling npm packages and cleaning my npm cache I finally got it to work again, both on android and ios.
I wasn't using that package, but due to lingering in my package.json and running npm update it went and broke something in my setup I suspect. If only I had removed it completely after not testing and deciding not using it.
I hope it helps people giving direction if you suddenly see installreacthook not found. It costs me 4 hours to figure out.

starter application react native error

I just started with react-native development on IOS and want to get my feet wet.
I did the following:
react-native init trail
and I opened the trail starter project in xcode and hit run. There were several small issues I fixed already including upgrading watchman, upgrading OSX. Currently the logs do not show any errors.
While the logs show that the packager runs, the build failed on XCode. A lot of errors showed up with the files in the Library folder. Many of them show up as Parse Issues, Semantic Issues.
I'm currently using Mac OSX Yosemite 10.10.5. Why did the started app fail to build?
Here are some code snippets of the errors:
code snippet 1
code snippet 2
Update your versions of node, npm and xCode.
Run 'react-native init yourAppName';
Run in yourAppNameFolder 'npm i' - to install all needed dependencies, which may be missing;
Run 'open yourAppNameFolder/ios/yourAppName.xcodeproj' where appFolder - folder which one have been initialized by command 'react-native init'.
This should help, and one more suggestion - don't touch this bloody xcode, better to run the app from the shell.

Can't require external react native Components

I'm currently trying to learn react Native. While building my first App I tryed to include a external Component from Github (https://github.com/voronianski/react-native-effects-view). Fallowing the small step by step instruction I installed the Component via npm npm install react-native-effects-view --save and included the native Code via XCode:
and required the Component via var EffectsView = require('react-native-effects-view');. After restarting the App I get the fallowing error: Error: Requiring unknown module "react-native-effects-view". If you are sure the module is there, try restarting the packager. (I did restart the package roughly 1000 times)
Maybe somebody can point out the mistake I did and explain me how to do it correct?
Thanks
Daniel
Try to run react-native run-ios. You need to run this after npm install.
you need to bundle your app again since emulator doesn't have the binary for react-native-effects-view module yet
so just run this command again
react-native run-ios

Resources