-1) Follow this official instruction to generate the release APK. a link
-2) Run this command below.
$ cd android
$ ./gradlew assembleRelease
-3) Result: I receive the following error message.
index.js: Cannot find module 'babel-preset-react-app'
Error: Cannot find module 'babel-preset-react-app'
I'm trying to create a release build for Android app using React Native. I've searched for potential solution including the below. But I haven't found anything that works for me. Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-react'
[package.json] Line 9 to 41
"dependencies": {
"mobx": "^5.9.0",
"mobx-react": "^5.4.3",
"react": "16.6.3",
"react-dom": "^16.7.0",
"react-native": "0.58.3",
"react-native-gesture-handler": "^1.0.15",
"react-native-image-pan-zoom": "^2.1.11",
"react-navigation": "^3.1.2"},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.3.0",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "24.0.0",
"jest": "24.0.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.6.3"},
"jest": {
"preset": "react-native"},
"babel": {
"presets": [
"react-app"
],
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
]
]
[index.js]
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
[app.js]
import React, {Component, PropTypes} from 'react';
import { Platform, StyleSheet, Text, View, Image, Dimensions, Button, TouchableHighlight, WebView } from 'react-native';
import { createStackNavigator, createAppContainer, StackActions, NavigationActions, withNavigation } from "react-navigation";
Expected result: Terminal will finish the process as described in this official guide and produce an apk file under this folder path android/app/build/outputs/apk/release/app-release.apk
React Native official guide: https://facebook.github.io/react-native/docs/signed-apk-android
Actual output: I receive the following error message.
index.js: Cannot find module 'babel-preset-react-app'
Error: Cannot find module 'babel-preset-react-app'
Any suggestion will be much appreciated.