React Native Crash Undefined is not an object (Evaluating 'Sn[e]') - reactjs

Any one facing react native build issue?
I am trying to generate debug build but its crashing when the app is launched .
The exception has no useful information.
I was facing the same issue with
sudo react-native run-android
But that got resolved after upgrading RN from 0.48 to 0.55(latest Stable Version)
But the crash remain same for the apk generated using
sudo gradlew assembleDebug
The crash is similar to
https://github.com/facebook/react-native/issues/16745
please see screenshot

After so much struggle , finding solutions from different sources , I got to know that assembleDebug is not bundling by itself. So bundle it assets explicitly using below command
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
and then generate build
sudo gradlew assembleDebug

Related

Metro bundler crashing

https://github.com/inspmoore/rnw_boilerplate_nav
the web is running fine but the metro bundler is crashing every time am hitting react-native run-android,
I need help desperately kindly guide me with the reason of the crash.
Screenshot of error
[UPDATE]
As per Unable to load script from assets index.android.bundle on windows, on following the instructions when I
give
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
as command am recieving
Invalid regular expression: /(.\fixtures\.|node_modules[\]react[\]dist[\].|website\node_modules\.|heapCapture\bundle.js|.\tests\.)$/: Unterminated character class

Generating a release bundle package for UWP app with react-native-windows

I am trying to generate a release bundle package for UWP application developed using react-native-windows to upload on microsoft store.
I am using Visual Studio 2017.
Environment:
react-native -v: v0.59.10
npm ls rnpm-plugin-windows: ^0.4.0
npm ls react-native-windows: “0.59.0-legacy.2”
node -v: 10.15.3
npm -v: 6.4.1
Using below command to generate a windows bundle file,
"react-native bundle --platform windows --entry-file index.js --bundle-output windows/project_name/ReactAssets/index.windows.bundle --assets-dest windows/project_name/ReactAsset
Debug build happens quick and able to run the app.
Release build is taking hours and getting a freeze.
Though it takes time, has anyone succeeded in generating a release build?
Does any of the solution above works completely? Found in few threads that release build can be taken, but app crashes on launch.
If there is no option, can debug build be published to store? (Worst case)
Requesting immediate attention on this.
It would be great help if anyone can help me resolve this issue.
Thanks in advance.

Build failed for task ':app:bundleReleaseJsAndAssets' in react native

At the time of release build getting error in react native
In your scenario I think you haven't made a js bundle so please make a bundle first by using command from your project root folder
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
After that move in to your project's android directory using cd android
Before make release build make sure to clean your gradle using ./gradlew clean
And finally run this command ./gradlew assembleRelease -x bundleReleaseJsAndAssets
I have posted a full answer on this issue on here

error while trying to install react-native -floating-action

when I'm trying to install some package
like:
react-native-floating-action
or:
react-native-action-button
I'm running the
npm i react-native-floating-action --save
and when I run react-native link
i get this error:
PS C:\Projects\projectname> react-native link
rnpm-install info Linking assets to ios project
rnpm-install ERR! Something went wrong while linking. Error: Cannot read property 'pbxprojPath' of null
Please file an issue here: https://github.com/facebook/react-native/issues
Cannot read property 'pbxprojPath' of null
TypeError: Cannot read property 'pbxprojPath' of null
at Object.linkAssetsIOS [as copyAssets] (C:\Projects\projectname\node_modules\react-native\local-cli\link\ios\copyAssets.js:24:41)
at C:\Projects\projectname\node_modules\react-native\local-cli\link\link.js:104:12
at Array.forEach (<anonymous>)
at linkAssets (C:\Projects\projectname\node_modules\react-native\local-cli\link\link.js:94:28)
at C:\Projects\projectname\node_modules\react-native\local-cli\link\link.js:171:30
these are my versions:
react-native-cli: 2.0.1
react-native: 0.57.1
npm --version
6.4.1
expo --version
2.6.14
Expo does not support linked binaries. If you require linked binaries, you must first Eject from Expo to ExpoKit or initialize your project using react-native init MyProjName
Reference
If you know that you'll eventually need to include your own native code, Expo is still a good way to get started. In that case you'll just need to "eject" eventually to create your own native builds. If you do eject, the "Building Projects with Native Code" instructions will be required to continue working on your project.
https://facebook.github.io/react-native/docs/getting-started.html
This worked for me:
npm update
react-native link
Eventually, I found the problem,
I needed to run react-native upgrade, and had a different version of react-native in the package.json from the node_modules
writing ^0.57.8 (current react-native version) on the packge.json:
"react-native": "^0.57.8",
running npm install
setting a name for the project in the package.json:
"name":"somename"
and running
react-native upgrade
react-native link
everything was ok
seems to me that it's always a matter of versions with react-native errors

Module HMRClient is not a registered callable module (calling enable) in Linux

First When I created the app with react-native init project1 .
I was getting an error as below
Unable to load script from assets index.android.bundle on windows
Later I solved this issue by running following commands Stackoverflow link
mkdir android/app/src/main/assets
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
react-native run-android
But later I am getting an error like this and not able to solve, Module HMRClient is not a registered callable module (calling enable)
This is the common occurred problem, but there will not be some problem in bundling the app, Just follow some common steps and it worked for me.
Delete node_module folder and install npm
rm -rf node_modules && npm install
cd android && ./gradlew clean
then cd .. && react-native run-android
If you're developing a native module and your npm link'd folder contains a node_modules directory, this can also produce the error.
To correct for this case, you can delete the node_modules directory, re-install your project in the linked folder and use react-native start --reset-cache.
Disable hot reloading, it will work fine
This issue occurs if we enabled the production mode from dev setting by unchecking "JS Dev Mode" and then try to enable the hot reload.
Enable JS Dev Mode again will work.

Resources