React-native monorepo iOS release build crash - ios

I have a monorepo with this architecture :
├── node_modules
├── packages
├── app # React native project
├── android
└── ios
├── common # TS package
└── web # Next JS project
In common package I have some shared services such as API calls for web front and mobile app.
During development phases, build and run process were working fine for both app and web.
Now I would like to publish my app to the app store but I'm not able to compile a working release ios app.
I have this crash logs when launching the app :
022-06-02 15:33:14.173898+0200 XXXX[33899:2579321] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: 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.', reason: 'Unhandled JS Exception: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the applica..., stack:
<unknown>#13:289
value#760:3143
<unknown>#760:747
value#760:2538
value#760:719
value#(null):(null)
'
*** First throw call stack:
(0x185361288 0x19e05b744 0x1003c0538 0x10043fd8c 0x10044066c 0x1852e9b24 0x185307610 0x18533e5fc 0x1003d7bd4 0x1003f5e98 0x1003f5ac8 0x184fc6e6c 0x184fc8a30 0x184fd0124 0x184fd0c80 0x184fdb500 0x1f6c240bc 0x1f6c23e5c)
libc++abi: terminating with uncaught exception of type NSException
I follow this article to build monorepo : https://medium.com/#ratebseirawan/react-native-0-63-monorepo-walkthrough-36ea27d95e26.
I have in my xcode project, Build Phases > Bundle React Native code and images :
set -e
export NODE_BINARY=node
export EXTRA_PACKAGER_ARGS="--entry-file packages/app/index.js --reset-cache"
../../../node_modules/react-native/scripts/react-native-xcode.sh "packages/app/index.js"
and in Start packager :
export RCT_METRO_PORT="${RCT_METRO_PORT:=8081}"
echo "export RCT_METRO_PORT=${RCT_METRO_PORT}" > "${SRCROOT}/../../../node_modules/react-native/scripts/.packager.env"
if [ -z "${RCT_NO_LAUNCH_PACKAGER+xxx}" ] ; then
if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then
if ! curl -s "http://localhost:${RCT_METRO_PORT}/status" | grep -q "packager-status:running" ; then
echo "Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly"
exit 2
fi
else
open "$SRCROOT/../../../node_modules/react-native/scripts/launchPackager.command" || echo "Can't start packager automatically"
fi
fi
In my AppDelegate.m
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"packages/app/index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];
#endif
}
metro.config.js :
const {getDefaultConfig} = require("metro-config");
const path = require('path');
module.exports = (async () => {
const {
resolver: {sourceExts, assetExts}
} = await getDefaultConfig();
return {
projectRoot: path.resolve(__dirname, '../../'),
transformer: {
babelTransformerPath: require.resolve("react-native-svg-transformer"),
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
resolver: {
assetExts: assetExts.filter(ext => ext !== "svg"),
sourceExts: [...sourceExts, "svg"]
}
};
})();
Env :
react-native 0.67.4
output of npx react-native info :
System:
OS: macOS 12.3.1
CPU: (8) arm64 Apple M1
Memory: 555.95 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.5.0 - /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8092744
Xcode: 13.4/13F17a - /usr/bin/xcodebuild
Languages:
Java: 17.0.2 - /usr/bin/javac
npmPackages:
#react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
I think that the main.js bundle generated is at the wrong place but I don't find the solution, have you any idea ?
Thanks !

in your packages/app/metro.config.js file did you do the changes that are shown in the article?
also and could you share that file.
(The article that you mentioned was specifically supposed to work with ReactNative 0.63, at that time there was little to no tooling to work with React Native on a Monorepo but now we have great tooling and support for it that will solve these annoying issues out of the box, I personally have been using https://nx.dev/guides/react-native)
for your issue tho I can try to help but there might be many things that could cause the error, one might be behind the M1 chip (doesn't have to be tho)
another info that might help, I read the patch notes of RN version 0.65 or 0.66 that they fixed an issue with monorepos where metro doesn't work nicely with symlinks so that might help.
but if I where you, I would clone the NX monorepo template and see their setup and compare with what you have (Files I would look at are metro.config. info.plist. babel.config)

Atm, I found a temporarily workaround :
I added in packages/app/package.json :
"build-prod:ios": "react-native bundle --platform ios --dev false --entry-file ./packages/app/index.js --bundle-output ios/MyAppName/main.jsbundle --assets-dest ios",
in Xcode > Build Phases > Copy Bundle Ressources :
add main.jsbundle
Comment all lines in "Bundle React Native code and images" and "Start packager"
For each new release, I now need to run yarn build-prod:ios before use xcode to build.

Related

Expo build fails in CI but builds locally (babel-preset-expo has been ignored because it contains invalid configuration)

Classic case of it works on my machine. I am building two react-native apps. App A and App B. Both of the applications were bootstrapped using expo.
When I run the command to build either app locally expo build:ios they both build. Yet when I attempt to build the applications in gitlab-ci only application B fails to build with the following message:
[23:07:28] warn Package babel-preset-expo has been ignored because it contains invalid configuration. Reason: Cannot find module 'babel-preset-expo/package.json'
[23:07:28] Require stack:
[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/#react-native-community/cli/build/tools/config/resolveNodeModuleDir.js
[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/#react-native-community/cli/build/tools/releaseChecker/index.js
[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/#react-native-community/cli/build/commands/server/runServer.js
[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/#react-native-community/cli/build/commands/server/server.js
[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/#react-native-community/cli/build/commands/index.js
[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/#react-native-community/cli/build/index.js
[23:07:28] - /builds/XXX/application-b/node_modules/react-native/local-cli/cli.js
[23:07:28]
[23:07:29] Starting Metro Bundler on port 19001.
[23:07:29] debug Watch mode is not supported in this environment
[23:07:29] debug Checking for a newer version of React Native
[23:07:29] debug Current version: 0.61.4
[23:07:29] debug No release cache found
[23:07:29] debug No release cache found
[23:07:29] debug Checking for newer releases on GitHub
[23:07:29] debug No release cache found
[23:07:30] Publishing to channel 'default'...
[23:07:30] debug Saving "6d6386b01438c6ef0acd213d304b5839" to cache
[23:07:30] debug No release cache found
[23:07:30] debug No release cache found
[23:07:30] debug Latest release: 0.60.0
[23:07:32] Building iOS bundle
[23:07:43] node_modules/expo/AppEntry.js: Cannot find module 'babel-preset-expo' from '/builds/XXX/application-b'
[23:07:43] › Closing Expo server
[23:07:43] node_modules/expo/AppEntry.js: Cannot find module 'babel-preset-expo' from '/builds/XXX/application-b'
[23:07:43] Failed building JavaScript bundle.
[23:07:43] ::ffff:127.0.0.1 - - [06/Apr/2020:23:07:43 +0000] "GET /node_modules/expo/AppEntry.bundle?dev=false&minify=true&hot=false&platform=ios HTTP/1.1" 500 - "-" "axios/0.19.0"
[23:07:43] › Stopping Metro bundler
[23:07:43] Packager URL http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?dev=false&minify=true&hot=false&platform=ios returned unexpected code 500. Please open your project in the Expo app and see if there are any errors. Also scroll up and make sure there were no errors or warnings when opening your project.
I have tried having the CI explicitly install the module babel-preset-expo, but that does not fix the issue. My babel.config.js is identical for both apps and looks like this:
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
I have the following lines in my both of my package.json:
"devDependencies": {
"#babel/core": "^7.0.0",
"babel-preset-expo": "^8.0.0"
},
The file in both applications being referenced in the error AppEntry.js is identical as well.
Here is my gitlab-ci.yml:
image: node/alpine
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ~/.npm
stages:
- deploy
- tag
before_script:
- echo $CI_BUILD_REF
- echo $CI_PROJECT_DIR
- apk add --no-cache bash build-base gcc git python3 curl
- PATCH=`git log --pretty=oneline | wc -l | sed -e 's/^[[:space:]]*//'`
- VERSION=`cat VERSION`
- VERSION=${VERSION%?}
- TAG="${VERSION}${PATCH}"
- echo "Build version = ${TAG}"
expo-build:
stage: deploy
artifacts:
paths:
- ipas/
script:
- sed -i "s/0.0.0/${TAG}/g" app.json
- npm ci --production --cache .npm --prefer-offline
- npx expo login -u $EXPO_USERNAME -p $EXPO_PASSWORD
- EXPO_DEBUG=true npx expo build:ios --non-interactive # This works because it has been already built once through the cli, credentials cannot be pass into env
- mkdir -p ipas
- curl "$(npx expo url:ipa --non-interactive)" -o ipas/bravo-teller-$TAG.ipa
only:
- master
Any feedback or suggestions as to what this could be would be greatly appreciated. Thanks
Actually, the babel-preset-expo is not a devDependencies you should add it to dependencies furthermore likely you should use lazy load by using the following code on your babel configuration:
[
'babel-preset-expo',
{
lazyImports: true,
},
]

react native ios build succeeds but path to app bundle is wrong

When I run react-native run-ios build succeeds and created build folder under ios. But after build, when installation starts, get the below error. The project runs successfully when I run it through xcode. What I observed is that path beginning 'DerivedData' is wrong. Instead it should be 'build'. When I rename my 'build' folder to 'DerivedData' and re-run 'react-native run-ios' the whole process completes successfully but of course with the previous build.
How can I change the 'DerivedData' to 'build'?
This error occurred immediately after I upgraded from 0.59.9 to 0.60.0.
Error:
info Installing "DerivedData/Build/Products/Debug-iphonesimulator/mobileappname.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
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/mobileappname.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
. Run CLI with --verbose flag for more details.
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/mobileappname.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at runOnSimulator (/Users/armaneker/WebstormProjects/mobileappname/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:189:45)
at process._tickCallback (internal/process/next_tick.js:68:7)
React Native version:
System:
OS: macOS 10.15
Binaries:
Node: 10.15.3 - /usr/local/bin/node
npm: 6.13.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Xcode: 11.0/11A420a - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.0 => 0.60.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Steps To Reproduce
used rn-diff-purge to upgrade from 0.59.9 to 0.60.0
android worked correctly
react-native run-ios build succeeded but installation of
app failed
The solution is not obvious, react-native-cli is trying to guess what xcode build configuration is currently setup on your computer which is what is happening on the function getBuildPath()
function getBuildPath(configuration, appName, isDevice, scheme) {
let device;
if (isDevice) {
device = 'iphoneos';
} else if (appName.toLowerCase().includes('tvos')) {
device = 'appletvsimulator';
} else {
device = 'iphonesimulator';
}
let buildPath = `build/${scheme}/Build/Products/${configuration}-${device}/${appName}.app`; // Check wether app file exist, sometimes `-derivedDataPath` option of `xcodebuild` not works as expected.
if (!_fs().default.existsSync(_path().default.join(buildPath))) {
return `DerivedData/Build/Products/${configuration}-${device}/${appName}.app`;
}
return buildPath;
}
The trick is not to patch this file, but to first setup your xcode configuration correctly Xcode > Preferences > Locations (see picture)
and Xcode > Preferences > Locations > Advanced
Once this is done, you have to cleanup your build folder, otherwise, react-native-cli will still assume that xcode is not behaving as expected, which will keep on producing the same error.
cd ios && rm -rf build
you can now execute npx react-native run-ios and everything should be fine again.
It took me quite some time to figure this out, I think that react-native-cli should output more details on what is going on under the hood for people not to be blocked.
Problem solved. I had to edit a file inside #react-native-community.
If anyone else has the same problem solution is below.
File location:
-> file:
-> node_modules
-> #react-native-community
-> cli-platform-ios
-> build
-> commands
-> runIOS
-> index.js line 314
Change:DerivedData/Build/Products/${configuration}-${device}/${appName}.app
To:build/Build/Products/${configuration}-${device}/${appName}.app
Cheers.

Ionic cordova build iOS not creating build folder and getting sass gulp error

I just upgraded my MacOS environment from Ionic CLI 1.7.14 to v5.2.6. This also required me to upgrade NodeJS to v10.16.3. I am having several issues but one of which is when I build the app the platforms/ios/build directory is not being created.
However, I can deploy the app right from Xcode to my test phone - but its all wonky, missing images, backend server api calls not working, in app url links to other in app pages not working. Even after deploying from Xcode though there still is no build directory. As well, Safari web inspector would open a blank window...no elements, console info, nothing.
It doesn't appear that I have any errors in my build. Below is the --verbose output:
/users/macknife/dev/MyApp> ionic cordova build ios --buildFlag='-UserModernBuildSystem=0' --verbose
ionic:lib Terminal info: { ci: false, shell: '/bin/bash', tty: true, windows: false } +0ms
ionic:lib CLI global options: { _: [ 'cordova', 'build', 'ios' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, buildFlag: '-UserModernBuildSystem=0', project: null, '--': [] } +5ms
ionic:lib:project Project type from config: Ionic 1 (ionic1) +0ms
ionic:lib:project Project details: { configPath: '/Users/macknife/dev/MyApp/ionic.config.json', errors: [], context: 'app', type: 'ionic1' } +0ms
ionic Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic', execPath: '/Users/macknife/dev/MyApp', version: '5.2.6' } +0ms
ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: '/Users/macknife/dev/MyApp/config.xml', package.json: '/Users/macknife/dev/MyApp/package.json') +0ms
ionic:lib:build build options: { '--': [],
ionic:lib:build engine: 'cordova',
ionic:lib:build platform: 'ios',
ionic:lib:build project: undefined,
ionic:lib:build verbose: false,
ionic:lib:build type: 'ionic1' } +0ms
ionic:lib:telemetry Sending telemetry for command: 'ionic cordova build' [ 'ios',
ionic:lib:telemetry '--verbose',
ionic:lib:telemetry '--interactive',
ionic:lib:telemetry '--color',
ionic:lib:telemetry '--build-flag=-UserModernBuildSystem=0' ] +0ms
ionic:lib:hooks Looking for ionic:build:before npm script. +0ms
ionic:lib:build Looking for ionic:build npm script. +12ms
> ionic-v1 build
ionic:v1-toolkit:lib:gulp Using gulpfile: /Users/macknife/dev/MyApp/gulpfile.js +0ms
ionic:v1-toolkit:lib:gulp Using gulp: /Users/macknife/dev/MyApp/node_modules/gulp/index.js +2ms
ionic:v1-toolkit:lib:gulp Loaded gulp tasks: { default: { fn: [Function], dep: [ 'sass' ], name: 'default' }, sass: { fn: [Function], dep: [], name: 'sass' }, watch: { fn: [Function], dep: [ 'sass' ], name: 'watch' } } +957ms
[10:25:49] Invoking sass gulp task.
ionic:lib:hooks Looking for ionic:build:after npm script. +3s
> cordova build ios --verbose
No scripts found for hook "before_build".
Executing script found in plugin cordova-custom-config for hook "before_prepare": plugins/cordova-custom-config/hooks/restoreBackups.js
cordova-custom-config: Loaded module dependencies
cordova-custom-config: Running restoreBackups.js
cordova-custom-config: Skipping auto-restore of config file backup(s)
Executing script found in plugin cordova-custom-config for hook "before_prepare": plugins/cordova-custom-config/hooks/applyCustomConfig.js
cordova-custom-config: Loaded module dependencies
cordova-custom-config: Running applyCustomConfig.js
cordova-custom-config: Finished applying platform config
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform ios
Checking for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in ios platform
No differences found between plugins added to project and installed in ios platform. Continuing...
Generating platform-specific config.xml from defaults for iOS at /users/macknife/dev/MyApp/platforms/ios/MyApp/config.xml
Merging project's config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
copy www/css/ionic.app.css platforms/ios/www/css/ionic.app.css (updated file)
copy www/css/ionic.app.min.css platforms/ios/www/css/ionic.app.min.css (updated file)
copy www/index.html platforms/ios/www/index.html (updated file)
Current launch storyboard CDVLaunchScreen
Not changing launch storyboard setting in info plist.
Wrote out iOS Bundle Version "0.2.90" to /users/macknife/dev/MyApp/platforms/ios/MyApp/MyApp-Info.plist
No need to update build settings for launch storyboard support.
Set IPHONEOS_DEPLOYMENT_TARGET to "9.3".
Did not update build settings for launch storyboard support.
iOS Product Name has not changed (still "MyApp")
Updating icons at platforms/ios/MyApp/Images.xcassets/AppIcon.appiconset/
Updating splash screens at platforms/ios/MyApp/Images.xcassets/LaunchImage.launchimage/
Updating launch storyboard images at platforms/ios/MyApp/Images.xcassets/LaunchStoryboard.imageset/
Updating Storyboard image set contents.json
This app does not have additional resource files defined
Prepared iOS project successfully
Executing script found in hooks directory for hook "after_prepare": hooks/after_prepare/010_add_platform_class.js
Running command: /users/macknife/dev/MyApp/hooks/after_prepare/010_add_platform_class.js /users/macknife/dev/MyApp
add to body class: platform-ios
Command finished with error code 0: /users/macknife/dev/MyApp/hooks/after_prepare/010_add_platform_class.js /users/macknife/dev/MyApp
Executing script found in plugin cordova-custom-config for hook "after_prepare": plugins/cordova-custom-config/hooks/applyCustomConfig.js
cordova-custom-config: Loaded module dependencies
cordova-custom-config: Running applyCustomConfig.js
cordova-custom-config: Finished applying platform config
Executing script found in plugin cordova-plugin-facebook4 for hook "after_prepare": plugins/cordova-plugin-facebook4/scripts/after_prepare.js
Executing script found in plugin cordova-plugin-firebasex for hook "after_prepare": plugins/cordova-plugin-firebasex/scripts/after_prepare.js
Preparing Firebase on iOS
Ionic:
Ionic CLI : 5.2.6 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic1 1.0.0
#ionic/v1-toolkit : 1.0.22
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : ios 5.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 32 other plugins)
Utility:
cordova-res : 0.6.0
native-run : 0.2.8
System:
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v10.16.3 (/usr/local/bin/node)
npm : 6.11.2
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61
======================
On a hunch, I removed the auto-installed Cordova-plugin-ionic-webview (that seems to be standard with Ionic CLI when building a new app) and returned to using a my previous web view-plus (yes, very old, but its what I have been using until this big CLI upgrade - and it was working just fine). I tried building again from console and it did so without any error but again no platform/ios/build folder - however, I could deploy my app cleanly from Xcode - all the wonky stuff was gone - and my app was working AND I could manage the app from Safari web inspector again. Something about ionic-web view must be causing all the wonkiness - but still does not explain the build issue.
This is often the caused by several versions of gulp installed at the same time.
Try deleting both the package-lock.json file and node_modules folder. Then reinstall the dependencies with npm i and try building your app again.
I've encountered a similar situation before. This is the solution which worked for me:
Remove the IOS platform ionic cordova platform remove ios
Add the platform again ionic cordova platform add ios
Use XCode to configure signature settings
Also in XCode under File -> Workspace settings enable the "Legacy build system"
Try your build again
I reinstalled my project and aligned my gulp versions and issue still was happening.
Turns out the Preparing Firebase on iOS was the clue. Its the last message before the build prematurely exits, but exits with no errors, issues, warnings or anything.
Cordova-plugin-firebasex #6.0.7 has an issue that hoses the build. I downgraded to v6.0.6 and everything builds fine now.

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.

Bundlejs error on release build in Xcode (react-native)

For some reason I am getting the following error when building a release version of my application via react-native.
*** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: t.typeof is not a function. (In 't.typeof("function"==typeof Symbol?Symbol.iterator:"##iterator")', 't.typeof' is undefined) (/Users/../THEAPP.app/main.jsbundle:11)', reason: 'Unhandled JS Exception: t.typeof is not a function. (In 't.typeof("function...'
This is the source of the code that has the above error that I found in my bundlejs file:
!(function(e){"use strict";var r,t=e.babelHelpers={};t.typeof="function"==typeof Symbol&&"symbol"===t.typeof("function"==typeof Symbol?Symbol.iterator:"##iterator")?
I have tried both of these methods of a release build:
Making bundle by editing the Scheme to be a Release bundle
Export a bundle myself by using the following: react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
I get the same error for both of these. And of course, this is after I change my AppDelegate.m to the following:
//jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil];
jsCodeLocation = [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];
I also followed someone's response from Github issues and tried the following, but got another separate issue entirely after the fact:
I did:
npm uninstall -g babel-preset-env
npm install --save #babel/preset-env
Added this to my package.json file
"babel": { "presets": ["#babel/preset-env", "react-native"] }
And created a .babelrc file in my root project with:
{ "presets": ["#babel/preset-env", "react-native"] }
Then get this on an Xcode build:
Environment
OS: macOS High Sierra 10.13.4
Node: 9.11.1
npm: 5.6.0
Watchman: 4.9.1
Xcode: Version 9.4 (9F1027a)
react: 16.3.1
react-native: 0.55.4
I solved this by completely restarting my app and using:
react-native init PROJECTNAME

Resources