React Native IOS/ Expo build failing for multiple reasons - ios

A expo build is failing on my computer though it is working on the other developers' laptop. The discrepancies are that he is running another version of IOS on his simulator, we don't see this being the issue though.
Problem:
After an expo start -c & running on IOS the build fails with the following errors:
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:17 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:39 in handleError
at node_modules/#react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules/metro-runtime/src/polyfills/require.js:237:40 in guardedLoadModule
at http://192.168.0.62:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:null in global code
Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
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.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:17 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:39 in handleError
at node_modules/#react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
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.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:17 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:39 in handleError
at node_modules/#react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError```
Has anyone seen this or does anyone have ideas on how to get around this issue?
I have tried npm install, clearing caches, resetting file paths, and rebuilding expo builds.

Related

Invariant Violation: Native module cannot be null.Invariant Violation: "main" has not been registered

When running expo run:ios, i am getting the following error:
Invariant Violation: Native module cannot be null.
Invariant Violation: "main" has not been registered. This can
happen if:
Metro (the local dev server) is run from the wrong folder. Check if Metro is
running, stop it and restart it in the current project.
A module failed to load due to an error and AppRegistry.registerComponent
wasn't called.
My index.js file
import 'react-native-gesture-handler';
import { registerRootComponent } from 'expo';
import App from './App';
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
In appDelegate.m file the module name is "main"
succesful app loading on emulator without any error.

Amplify: Expo Could not connect to development server

I have a React-Native app, using AWS Amplify that works with Expo when testing using expo start --web, but I am trying to test on my iOS device and get a Could not connect to development server. Error. URL: http://192.168.1.6:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=ios&dev=true&hot=false&minify=false
EDIT: I have tried starting a blank project, using amplify pull, and then this error occurs:
jest-haste-map: Haste module naming collision: projectamplifyjsc7fc9745PostConfirmation
The following files share their name; please adjust your hasteImpl:
* <rootDir>\amplify\#current-cloud-backend\function\projectamplifyjsc7fc9745PostConfirmation\src\package.json
* <rootDir>\amplify\backend\function\projectamplifyjsc7fc9745PostConfirmation\src\package.json
Failed to construct transformer: DuplicateError: Duplicated files or mocks. Please check the console for more info
at setModule (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:620:17)
at workerReply (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:691:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 50) {
mockPath1: 'amplify\\#current-cloud-backend\\function\\projectamplifyjsc7fc9745PostConfirmation\\src\\package.json',
mockPath2: 'amplify\\backend\\function\\projectamplifyjsc7fc9745PostConfirmation\\src\\package.json'}
Error: Duplicated files or mocks. Please check the console for more info
at setModule (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:620:17)
at workerReply (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:691:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 50)
Error: Duplicated files or mocks. Please check the console for more info
at setModule (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:620:17)
at workerReply (C:\Users\me\Desktop\project\node_modules\jest-haste-map\build\index.js:691:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 50)
What is this and how to fix?
This answer comes from someone who had a similar issue with the Amplify API, find it here: Amplify React Native - Duplicate Error using amplify add api
Solution is simple (at least for me, guess it could depend on what amplify services you use).
Amplify creates a copy of your current cloud backend configuration in
amplify/#current-cloud-backend/.
You don't need those files to build your app, so you can ignore them
in order to get rid of the error.
To do so, you can create a blacklist and add the folder to it. Create
a rn-cli.config.js file in the root of your project.
./rn-cli.config.js:
require('metro').createBlacklist;
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = { resolver: {
blacklistRE: blacklist([/#current-cloud-backend\/.*/]), }, }; ```
See answer given here: https://stackoverflow.com/a/60899723/11255886

React Native: Module AppRegistry is not a registered callable module (calling runApplication)

I am trying to boot up a React Native 0.53.3 app with React 16.2.0 using simulator from Xcode 10.1 on High Sierra.
I previously had some issues that I have since resolved just to get the build to succeed:
npm-shrinkwrap.json: Could not install from "node_modules/react-navigation/react-native-tab-view#github:react-navigation/react-native-tab-view
React Native: ":CFBundleIdentifier", Does Not Exist
Now all build succeed even though I continue to get the cfbundleridentifier error:
Check dependencies
** BUILD SUCCEEDED **
Installing build/Build/Products/Debug-iphonesimulator/NFIBEngage.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/NFIBEngage.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Even in Metro Bundler it succeeds:
Metro Bundler ready.
Loading dependency graph, done.
BUNDLE [ios, dev] ./index.ios.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1667/1667), done.
BUNDLE [ios, dev] ./index.ios.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1/1), done.
DELTA [ios, dev] ./index.ios.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1667/1667), done.
MAP [ios, dev] ./index.ios.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1667/1667), done.
So I was wondering why my app when launched in simulator would stay stuck in the splashscreen, that usually only happens when an index.ios.js has failed. So I looked at http://localhost:8081/debugger-ui/ and sure enough I saw the following errors:
Module AppRegistry is not a registered callable module (calling runApplication)
Unhandled JS Exception: Cannot read property 'invocationEventNone' of undefined
Unhandled JS Exception: Module AppRegistry is not a registered callable module (calling runApplication)
I don't know where its getting invocationEventNone from, its not anything written in the codebase, I checked.
As far as the `AppRegistry` module, it appears to look fine:
import {AppRegistry} from 'react-native';
import KeyboardManager from 'react-native-keyboard-manager';
import NFIBEngage from './App';
KeyboardManager.setToolbarPreviousNextButtonEnable(true);
AppRegistry.registerComponent('NFIBEngage', () => NFIBEngage);
Has anyone experienced something like this running versions similar to what I am running? What should I be investigating? How to resolve this?
I followed every solution in here:
Module AppRegistry is not registered callable module (calling runApplication)
There was nothing in here that could help:
React Native Module AppRegistry is not a registered callable module
This was not relevant:
React Native(iOS) Module AppRegistry is not a registered callable module (calling runApplication)
Not relevant:
React native AppRegistry is not a callable module
I then tried following the solution offered by iDevAmit here:
React-Native: Module AppRegistry is not a registered callable module
but it appears my iOS which is what I am interested in running right now, is already linked according to this output:
rnpm-install info Platform 'ios' module appcenter is already linked
rnpm-install info Linking appcenter android dependency
rnpm-install info Platform 'android' module appcenter has been successfully linked
iOS App Secret is '00000000-0000-0000-0000-000000000000' set in ios/NFIBEngage/AppCenter-Config.plist
Added code to initialize iOS AppCenter SDK in ios/NFIBEngage/AppDelegate.m
Could not install dependencies using CocoaPods.
Please refer to the documentation to install dependencies manually.
Error Reason - Could not find "pod" command. Is CocoaPods installed?
Configuring AppCenter Analytics
rnpm-install info Platform 'ios' module appcenter-analytics is already linked
? For the Android app, should user tracking be enabled automatical
ly? (Use arrow keys)
❯ Enable Automatically
Enable in JavaScript iOS App Secret is '00000000-0000-0000-0000-000000000000' set in ios/NFIBEngage/AppCenter-Config.plist
? For the iOS app, should user tracking be enabled automatically?
(Use arrow keys)
❯ Enable Automatically
Enable in JavaScript
I did a Ctrl + C to get out and I do not know if the CocoaPods message is related as I have never used it. One time I tried a pod install and zsh could not find pod as a command.
Omar's solution does not work as it gave me Duplicate declaration "appName"
None of the other recommendations were applicable and upgrading React Native is not an option for this project.
In my Xcode 10.1 I have the current configuration inside of Project Settings -> Advanced button:
In this post:
React Native IOS Build CFBundleIdentifier Does not Exist
I already have what SUMIT and priyanga recommended.
What resolved this error was by removing the Instabug library and code from App.js file:
export default class appName extends PureComponent {
constructor() {
super();
this._startSentry();
// if (Platform.OS === "ios") {
// const key = base === "prod" ? env.instabug.prod : env.instabug.beta;
// Instabug.startWithToken(key, Instabug.invocationEvent.twoFingersSwipe);
// }
// Instabug.setIntroMessageEnabled(false);
// appcenter.trackAppOpened();
}
as I was also getting invocationEvent undefined along with that AppRegistry error.

React native build to device failed

I'm trying to build to an iOS device, building to simulator works fine.
This is what I get:
uncaught error Error: TypeError: unsupported file type at lookup (/Users/NAME/git/vex/vex-app react/VexAppReact/node_modules/image-size/lib/index.js:35:9)
at /Users/NAME/git/vex/vex-app-react/VexAppReact/node_modules/image-size/lib/index.js:93:22
at /Users/NAME/git/vex/vex-app-react/VexAppReact/node_modules/image-size/lib/index.js:50:9
at /Users/NAME/git/vex/vex-app-react/VexAppReact/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:82:15)
See logs /var/folders/h8/42h3w_qd2r9fvpwy99jsnjq40000gn/T/react-packager.log
at SocketClient._handleMessage (SocketClient.js:144:23)
at BunserBuf. (SocketClient.js:53:42)
at emitOne (events.js:90:13)
at BunserBuf.emit (events.js:182:7)
at BunserBuf.process (/Users/NAME/git/vex/vex-app-react/VexAppReact/node_modules/bser/index.js:289:10)
at /Users/NAME/git/vex/vex-app react/VexAppReact/node_modules/bser/index.js:244:12
at nextTickCallbackWith0Args (node.js:452:9)
at process._tickCallback (node.js:381:13)
Command /bin/sh failed with exit code 1
I'm assuming there's something wrong with image assets. I didn't install the image-size node module myself, so I doubt there's something wrong with that module, it could be though.
Any suggestions welcome.
Solution: apparently you can't add png files to native ios build

Chicagoboss make error for lager

I am porting my web application developed in Chicagoboss from my mac to ubuntu. But when I run make on ubuntu I get the following error:
ERROR: pre_compile failed while processing /home/myname/myapp_priv: {'EXIT',{undef,[{lager,start,[],[]},
{boss_rebar,compile,4,
[{file,"../ChicagoBoss-0.8.12/priv/rebar/boss_rebar.erl"},
{line,97}]},
{boss_plugin,pre_compile,2,
[{file,"priv/rebar/boss_plugin.erl"},{line,105}]},
{rebar_core,run_modules,4,[]},
{rebar_core,execute,5,[]},
{rebar_core,process_dir1,6,[]},
{rebar_core,process_commands,2,[]},
{rebar,main,1,[]}]}}
make: *** [all] Error 1
Am I missing something? Thanking all in advance.
This error indicates, that lager parse transforms are not present while compiling. Lager does not define functions like lager:info or lager:error directly. During compilation, it changes those calls adding line number and other useful things.
Your problem can be usually solved by moving lager before any other dependency in ./deps/boss/rebar.config or adding it as a dependency directly to your application in ./rebar.config.

Resources