404 Error Cannot find entry file index.js - react-native

I'm getting this error:
The development server returned response 404. Cannot find entry file
index.js.
Here is my folder structure:
package.json
{
"name": "vepo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"rnpm": {
"assets": [
"./app/fonts"
]
},
"jest": {
"preset": "react-native",
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
}
},
"dependencies": {
"flow-typed": "^2.0.0",
"generator-rn-toolbox": "^2.2.0",
"imagemagick": "^0.1.3",
"immutable": "^3.8.1",
"native-base": "2.3.0",
"prop-types": "^15.5.10",
"react": "16.0.0",
"react-native": "0.50.3",
"react-native-aws3": "^0.0.8",
"react-native-blur": "^3.1.3",
"react-native-communications": "^2.2.1",
"react-native-drawer": "^2.3.0",
//"react-native-fbsdk": "git://github.com/facebook/react-native-fbsdk#065507aa1d2b8b0b6cb50d13117694123f8303fa",
"react-native-git-upgrade": "^0.2.7",
"react-native-image-picker": "^0.26.4",
"react-native-interactable": "^0.1.2",
"react-native-mail": "^3.0.2",
"react-native-maps": "^0.16.4",
"react-native-modal": "^2.3.2",
"react-native-modalbox": "^1.3.9",
"react-native-multiple-choice": "^0.0.8",
"react-native-navigation": "^1.1.100",
"react-native-off-canvas-menu": "^0.1.31",
"react-native-optimized-flatlist": "^1.0.1",
"react-native-redux-router": "^1.0.7",
"react-native-select-multiple": "^1.0.3",
"react-native-side-menu": "^0.20.1",
"react-native-vector-icons": "^4.4.0",
"react-navigation": "^1.0.0-beta.11",
"react-redux": "^5.0.3",
"redux": "^3.6.0",
"redux-immutable": "^4.0.0",
"redux-observable": "^0.14.1",
"reselect": "^3.0.0",
"rxjs": "^5.2.0",
"yoga": "^0.0.0"
},
"devDependencies": {
"babel-eslint": "^7.1.1",
"babel-jest": "19.0.0",
"babel-plugin-module-resolver": "^2.7.0",
"babel-preset-react-native": "3.0.1",
"eslint": "^3.17.0",
"eslint-plugin-flowtype": "^2.30.3",
"eslint-plugin-jsx": "^0.0.2",
"eslint-plugin-react": "^6.10.0",
"eslint-plugin-react-native": "^2.3.1",
"flow-bin": "^0.42.0",
"jest": "19.0.2",
"jest-cli": "^19.0.2",
"react-test-renderer": "~15.4.1",
"redux-devtools": "^3.3.2",
"remote-redux-devtools": "^0.5.7"
}
}
What am I doing wrong, to cause that error?

Create an index.js file in root directory of your project and copy your index.android.js or index.ios.js into it.
after RN 49 by default, we don't have different entries for ios and android. so we have just one index.js file that both android and ios use it.

Related

React Native Mobile Application Security Test

After archive react-native ios appication, I had test it on Immuniweb mobile application testing tool. I have got security issue given bellow.
EXPOSURE OF POTENTIALLY SENSITIVE DATA [DAST] [M2] [CWE-200]
Potentially sensitive or internal information is detected in the mobile application via tracing its system calls.
[POTENTIAL HEROKU API KEY FOUND]
We did not use HEROKU anyway.
This is my package.json contents.
{
"name": "",
"version": "0.0.1",
"private": true,
"scripts": {
"postinstall": "rn-nodeify --install fs,util,path,tls,stream,buffer,global,process --hack && patch-package",
"android": "ENVFILE=.env react-native run-android",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"
},
"dependencies": {
"#gorhom/bottom-sheet": "^4.4.3",
"#invertase/react-native-apple-authentication": "^2.2.2",
"#react-native-async-storage/async-storage": "^1.17.9",
"#react-native-community/checkbox": "^0.5.12",
"#react-native-community/cli": "^8.0.5",
"#react-native-community/datetimepicker": "^6.3.2",
"#react-native-community/push-notification-ios": "^1.10.1",
"#react-native-masked-view/masked-view": "^0.2.6",
"#react-native-picker/picker": "^2.4.4",
"#react-navigation/bottom-tabs": "^6.3.2",
"#react-navigation/native": "^6.0.10",
"#react-navigation/stack": "^6.2.1",
"#rneui/base": "^0.0.0-edge.2",
"#rneui/themed": "^0.0.0-edge.2",
"#types/jest": "^29.0.0",
"asyncstorage-down": "^4.2.0",
"aws-iot-device-sdk": "^2.2.12",
"aws-sdk": "^2.1203.0",
"axios": "^0.27.2",
"buffer": "^4.9.1",
"global": "^4.4.0",
"jsonwebtoken": "^8.5.1",
"jwt-decode": "^2.2.0",
"lodash.clonedeep": "^4.5.0",
"lodash.get": "^4.4.2",
"lodash.isempty": "^4.4.0",
"lodash.max": "^4.0.1",
"lodash.min": "^4.0.1",
"lodash.omit": "^4.5.0",
"lodash.unionby": "^4.8.0",
"moment": "^2.29.4",
"patch-package": "^6.4.7",
"path-browserify": "0.0.0",
"process": "^0.11.0",
"react": "18.0.0",
"react-native": "^0.69.2",
"react-native-config": "^1.4.6",
"react-native-date-picker": "^4.2.5",
"react-native-device-info": "^10.0.2",
"react-native-encrypted-asyncstorage": "^2.1.3",
"react-native-flash-message": "^0.3.1",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.4.2",
"react-native-iap": "^11.0.0-rc.7",
"react-native-modal-datetime-picker": "^14.0.0",
"react-native-pager-view": "^6.0.0",
"react-native-paper": "^4.12.4",
"react-native-picker-select": "^8.0.4",
"react-native-progress": "^5.0.0",
"react-native-push-notification": "^8.1.1",
"react-native-reanimated": "^2.13.0",
"react-native-safe-area-context": "^4.3.1",
"react-native-screens": "^3.15.0",
"react-native-svg": "^12.4.3",
"react-native-tab-view": "^3.1.1",
"react-native-vector-icons": "^9.2.0",
"react-native-webview": "^11.25.0",
"react-redux": "^7.2.2",
"readable-stream": "1.0.33",
"reanimated-bottom-sheet": "^1.0.0-alpha.22",
"redux": "^4.2.0",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.3",
"rn-swipe-button": "^1.3.7",
"save": "^2.4.0",
"stream": "^0.0.2",
"stream-browserify": "^1.0.0",
"toggle-switch-react-native": "^3.3.0",
"util": "~0.10.3",
"victory-native": "^36.5.3"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "7.13.8",
"#react-native-community/eslint-config": "1.1.0",
"babel-jest": "25.5.1",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^28.1.1",
"metro-react-native-babel-preset": "^0.70.3",
"prettier": "^2.7.1",
"react-test-renderer": "18.0.0",
"rn-nodeify": "^10.3.0"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./app/assets/fonts"
]
},
"react-native": {
"path": "path-browserify",
"_stream_transform": "readable-stream/transform",
"_stream_readable": "readable-stream/readable",
"_stream_writable": "readable-stream/writable",
"_stream_duplex": "readable-stream/duplex",
"_stream_passthrough": "readable-stream/passthrough",
"stream": "stream-browserify",
"tls": false,
"fs": "react-native-fs"
},
"browser": {
"path": "path-browserify",
"_stream_transform": "readable-stream/transform",
"_stream_readable": "readable-stream/readable",
"_stream_writable": "readable-stream/writable",
"_stream_duplex": "readable-stream/duplex",
"_stream_passthrough": "readable-stream/passthrough",
"stream": "stream-browserify",
"tls": false,
"fs": "react-native-fs"
}
}
I need help to overcome this security issue?

Android Debug crash on startup - Release working fine

React Native App crashes on Android device in debug mode. Using the release build or debugging on emmulator everything is working fine. Logcat only shows:
"05-09 13:56:13.218 31875 31875 D ReactNative: ReactInstanceManager.ctor()" no further messages.
I updated the react version some weeks ago to the newest version but i also did many code changes in the meanwhile and I primary used iOS for debugging so I am not shure which change causes the problem right now. Weeks ago everything was working fine on Android device while debugging.
iOS is working fine in debug and release mode on device and emmulator.
My package.json
{
"name": "project",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"lint": "eslint *.js **/*.js",
"postinstall": "./fix-rncamera-search-path.sh ./node_modules/react-native-camera/ios/RNCamera.xcodeproj/project.pbxproj"
},
"dependencies": {
"#babel/core": "^7.3.4",
"#react-native-community/async-storage": "^1.2.1",
"axios": "^0.18.0",
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"firebase": "^5.9.0",
"https": "^1.0.0",
"moment": "^2.24.0",
"react": "16.8.6",
"react-native": "0.59.8",
"react-native-actionsheet": "^2.4.2",
"react-native-camera": "^2.0.1",
"react-native-datepicker": "^1.7.2",
"react-native-device-info": "^1.0.0",
"react-native-easy-grid": "^0.2.0",
"react-native-elements": "^1.1.0",
"react-native-firebase": "^5.2.3",
"react-native-highlight-words": "^1.0.1",
"react-native-hyperlink": "0.0.14",
"react-native-image-crop-picker": "^0.21.3",
"react-native-image-resizer": "^1.0.1",
"react-native-iphone-x-helper": "^1.2.0",
"react-native-keyboard-aware-scroll-view": "^0.7.4",
"react-native-maps": "^0.23.0",
"react-native-maps-super-cluster": "^1.5.0",
"react-native-permissions": "^1.1.1",
"react-native-phone-call": "^1.0.9",
"react-native-picker-select": "^6.1.0",
"react-native-popup-dialog": "^0.14.52",
"react-native-qrcode-scanner": "^1.1.2",
"react-native-sound": "^0.10.12",
"react-native-touch-id": "^4.3.0",
"react-native-vector-icons": "^6.4.2",
"react-navigation": "^2.18.3",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-promise-middleware": "^6.1.0",
"redux-thunk": "^2.3.0",
"rn-fetch-blob": "^0.10.15"
},
"devDependencies": {
"#babel/core": "^7.3.4",
"#babel/preset-flow": "^7.0.0",
"#babel/runtime": "^7.3.4",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.5.0",
"eslint": "^5.15.3",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
"jest": "24.5.0",
"metro-react-native-babel-preset": "^0.53.1",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
},
"eslintConfig": {
"extends": "airbnb",
"parser": "babel-eslint",
"env": {
"jest": true
},
"rules": {
"no-use-before-define": "off",
"react/jsx-filename-extension": "off",
"react/prop-types": "off",
"react/sort-comp": "off",
"comma-dangle": "off",
"max-len": [
"error",
120
],
"no-else-return": "off"
},
"globals": {
"fetch": false
}
}
}

bundling failed: TypeError: Cannot read property 'bindings' of null at Scope.moveBindingTo

I've updated react native to 0.59.5 and am getting this error:
bundling failed: TypeError: Cannot read property 'bindings' of null
at Scope.moveBindingTo (/Users/ben/vepo/frontend/node_modules/#babel/traverse/lib/scope/index.js:864:13)
at convertBlockScopedToVar (/Users/ben/vepo/frontend/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:139:13)
at PluginPass.VariableDeclaration (/Users/ben/vepo/frontend/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:26:9)
at newFn (/Users/ben/vepo/frontend/node_modules/#babel/traverse/lib/visitors.js:193:21)
at NodePath._call (/Users/ben/vepo/frontend/node_modules/#babel/traverse/lib/path/context.js:53:20)
at NodePath.call (/Users/ben/vepo/frontend/node_modules/#babel/traverse/lib/path/context.js:40:17)
at NodePath.visit (/Users/ben/vepo/frontend/node_modules/#babel/traverse/lib/path/context.js:88:12)
at TraversalContext.visitQueue (/Users/ben/vepo/frontend/node_modules/#babel/traverse/lib/context.js:118:16)
at TraversalContext.visitSingle (/Users/ben/vepo/frontend/node_modules/#babel/traverse/lib/context.js:90:19)
Ive seen solutions to upgrade babel-preset-react-native to 5.0.2. I've done that and it didn't work. Another solution was to use metro-react-native-babel-preset instead. That didn't work either. Another solution was to use #babel/preset-env. That didn't work either. I even commented out the code that the error is complaining about so I don't even know how it is giving the same error on that commented out line of code now...Any ideas?
package.json
{
"name": "vepo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"rnpm": {
"assets": [
"./app/fonts"
]
},
"jest": {
"preset": "react-native",
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
}
},
"dependencies": {
"#babel/core": "^7.4.3",
"#babel/preset-env": "^7.4.3",
"babel-preset-react-native": "5.0.2",
"flow-typed": "^2.4.0",
"generator-rn-toolbox": "^2.2.0",
"imagemagick": "^0.1.3",
"immutable": "4.0.0-rc.9",
"list": "^2.0.15",
"metro-bundler": "^0.22.1",
"metro-react-native-babel-preset": "^0.53.1",
"native-base": "^2.3.3",
"prop-types": "^15.5.10",
"react": "16.8.3",
"react-native": "0.59.5",
"react-native-aws3": "^0.0.8",
"react-native-blur": "^3.1.3",
"react-native-check-box": "^2.1.0",
"react-native-communications": "^2.2.1",
"react-native-drawer": "^2.3.0",
"react-native-easy-toast": "^1.2.0",
"react-native-elements": "^0.19.1",
"react-native-fbsdk": "^0.8.0",
"react-native-gesture-handler": "1.0.12",
"react-native-git-upgrade": "^0.2.7",
"react-native-image-picker": "^0.26.7",
"react-native-interactable": "0.1.2",
"react-native-mail": "^3.0.2",
"react-native-maps": "^0.16.4",
"react-native-modal": "^2.3.2",
"react-native-modalbox": "^1.3.9",
"react-native-multiple-choice": "^0.0.8",
"react-native-navigation": "^1.1.100",
"react-native-off-canvas-menu": "^0.1.31",
"react-native-optimized-flatlist": "^1.0.1",
"react-native-redux-router": "^1.0.7",
"react-native-root-toast": "^3.0.2",
"react-native-select-multiple": "^1.0.3",
"react-native-side-menu": "^0.20.1",
"react-native-vector-icons": "^5.0.0",
"react-navigation": "3.0.8",
"react-navigation-tabs": "^1.0.1",
"react-redux": "^5.0.3",
"redux": "^3.6.0",
"redux-immutable": "^4.0.0",
"redux-observable": "^0.14.1",
"redux-thunk": "^2.3.0",
"reselect": "^3.0.0",
"rxjs": "^5.2.0",
"yarn": "^1.3.2",
"yoga": "^0.0.0"
},
"devDependencies": {
"adm-zip": "^0.4.11",
"babel-cli": "^6.26.0",
"babel-eslint": "^7.1.1",
"babel-plugin-module-resolver": "^2.7.0",
"babel-preset-flow": "^6.23.0",
"eslint": "^3.17.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-flowtype": "^2.30.3",
"eslint-plugin-jsx": "^0.0.2",
"eslint-plugin-react": "^6.10.0",
"eslint-plugin-react-native": "^2.3.1",
"flow-bin": "^0.75.0",
"plist": "^2.1.0",
"react-devtools": "^3.2.1",
"react-test-renderer": "~15.4.1",
"redux-devtools": "^3.3.2",
"remote-redux-devtools": "^0.5.7",
"remotedev-server": "^0.2.4",
"xcode": "^1.0.0"
}
}
.babelrc
{
"presets": ["#babel/preset-env"]
}
When I restarted my computer it worked.
code that worked:
.babelrc
{
"presets": ["module:metro-react-native-babel-preset"]
}
package.json
{
"name": "vepo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"rnpm": {
"assets": [
"./app/fonts"
]
},
"jest": {
"preset": "react-native",
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
}
},
"dependencies": {
"#babel/core": "^7.4.3",
"#babel/preset-env": "^7.4.3",
"babel-preset-react-native": "5.0.2",
"flow-typed": "^2.4.0",
"generator-rn-toolbox": "^2.2.0",
"imagemagick": "^0.1.3",
"immutable": "4.0.0-rc.9",
"list": "^2.0.15",
"metro-bundler": "^0.22.1",
"metro-react-native-babel-preset": "^0.53.1",
"native-base": "2.12.1",
"prop-types": "^15.5.10",
"react": "16.8.3",
"react-native": "0.59.5",
"react-native-aws3": "^0.0.8",
"react-native-blur": "^3.1.3",
"react-native-check-box": "^2.1.0",
"react-native-communications": "^2.2.1",
"react-native-drawer": "^2.3.0",
"react-native-easy-toast": "^1.2.0",
"react-native-elements": "^0.19.1",
"react-native-fbsdk": "^0.8.0",
"react-native-gesture-handler": "1.0.12",
"react-native-git-upgrade": "^0.2.7",
"react-native-image-picker": "^0.26.7",
"react-native-interactable": "0.1.2",
"react-native-mail": "^3.0.2",
"react-native-maps": "^0.16.4",
"react-native-modal": "^2.3.2",
"react-native-modalbox": "^1.3.9",
"react-native-multiple-choice": "^0.0.8",
"react-native-navigation": "^1.1.100",
"react-native-off-canvas-menu": "^0.1.31",
"react-native-optimized-flatlist": "^1.0.1",
"react-native-redux-router": "^1.0.7",
"react-native-root-toast": "^3.0.2",
"react-native-select-multiple": "^1.0.3",
"react-native-side-menu": "^0.20.1",
"react-native-vector-icons": "^5.0.0",
"react-navigation": "3.0.8",
"react-navigation-tabs": "^1.0.1",
"react-redux": "^5.0.3",
"react-timer-mixin": "^0.13.4",
"redux": "^3.6.0",
"redux-immutable": "^4.0.0",
"redux-observable": "^0.14.1",
"redux-thunk": "^2.3.0",
"reselect": "^3.0.0",
"rxjs": "^5.2.0",
"yarn": "^1.3.2",
"yoga": "^0.0.0"
},
"devDependencies": {
"adm-zip": "^0.4.11",
"babel-cli": "^6.26.0",
"babel-eslint": "^7.1.1",
"babel-plugin-module-resolver": "^2.7.0",
"babel-preset-flow": "^6.23.0",
"eslint": "^3.17.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-flowtype": "^2.30.3",
"eslint-plugin-jsx": "^0.0.2",
"eslint-plugin-react": "^6.10.0",
"eslint-plugin-react-native": "^2.3.1",
"flow-bin": "^0.75.0",
"plist": "^2.1.0",
"react-devtools": "^3.2.1",
"react-test-renderer": "~15.4.1",
"redux-devtools": "^3.3.2",
"remote-redux-devtools": "^0.5.7",
"remotedev-server": "^0.2.4",
"xcode": "^1.0.0"
}
}

React Native app:bundleReleaseJsAndAssets Error: The 'decorators' plugin requires a 'decoratorsBeforeExport' option

When I run ./gradlew assembleRelease I get back this error:
Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Loading dependency graph, done.
index.js: The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean. If you are migrating from Babylon/Babel 6 or want to use the old decorators proposal, you should use the 'decorators-legacy' plugin instead of 'decorators'.
Error: The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean. If you are migrating from Babylon/Babel 6 or want to use the old decorators proposal, you should use the 'decorators-legacy' plugin instead of 'decorators'.
I'm not using #Babel, but babel in my package.json file:
{
"name": "my-app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"#ptomasroos/react-native-multi-slider": "0.0.12",
"firebase": "^5.1.0",
"javascript-time-ago": "^1.0.30",
"mobx": "^4.1.1",
"mobx-react": "^5.0.0",
"native-base": "^2.8.1",
"prop-types": "^15.6.2",
"protobufjs": "^6.8.8",
"react": "16.2.0",
"react-native": "^0.57.7",
"react-native-actionsheet": "^2.3.0",
"react-native-aws3": "0.0.8",
"react-native-axios": "^0.17.1",
"react-native-billing": "^2.9.1",
"react-native-card-stack-swiper": "^1.0.5",
"react-native-collapsible": "^0.10.0",
"react-native-cookies": "^3.2.0",
"react-native-datepicker": "^1.6.0",
"react-native-dropdownalert": "^3.5.0",
"react-native-elements": "^0.19.0",
"react-native-event-listeners": "^1.0.3",
"react-native-expandable-section-flatlist": "^1.0.3",
"react-native-fbsdk": "^0.8.0",
"react-native-fcm": "^16.0.0",
"react-native-floating-action": "^1.10.1",
"react-native-geocoding": "^0.3.0",
"react-native-gifted-chat": "^0.4.3",
"react-native-google-places-autocomplete": "^1.3.6",
"react-native-hide-show-password-input": "^1.0.7",
"react-native-image-crop-picker": "^0.19.3",
"react-native-image-picker": "^0.26.10",
"react-native-image-placeholder": "^1.0.14",
"react-native-instagram-login": "^1.0.7",
"react-native-keyboard-aware-scroll-view": "^0.4.4",
"react-native-keyboard-aware-scrollview": "^2.0.0",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-linear-gradient": "^2.4.0",
"react-native-linkedin": "^1.3.1",
"react-native-localization": "^2.0.0",
"react-native-material-bottom-navigation": "^0.9.0",
"react-native-modal-datetime-picker": "^6.0.0",
"react-native-open-settings": "^1.0.1",
"react-native-pages": "^0.7.0",
"react-native-permissions": "^1.1.1",
"react-native-picker-select": "^5.1.0",
"react-native-popup-menu": "^0.12.4",
"react-native-pulse": "^1.0.6",
"react-native-scrollable-tab-view": "^0.8.0",
"react-native-share": "^1.0.26",
"react-native-simple-toast": "0.0.8",
"react-native-snap-carousel": "^3.7.2",
"react-native-splash-screen": "^3.0.6",
"react-native-star-rating": "^1.0.9",
"react-native-swipe-cards": "^0.1.1",
"react-native-swipe-list-view": "^1.0.7",
"react-native-swipeable-flat-list": "0.0.5",
"react-native-swipeout": "^2.3.3",
"react-native-switch": "^1.4.0",
"react-native-twitter-signin": "github:GoldenOwlAsia/react-native-twitter-signin#master",
"react-native-view-more-text": "^2.0.1",
"react-native-viewpager": "^0.2.13",
"react-navigation": "^1.0.3",
"rn-viewpager": "^1.2.9"
},
"devDependencies": {
"babel-jest": "22.2.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-react-native": "4.0.0",
"jest": "22.2.2",
"react-test-renderer": "16.2.0"
},
"jest": {
"preset": "react-native"
}
}
I finally solved this by installing this package: #babel/plugin-proposal-decorators and removing this one: babel-plugin-transform-decorators-legacy
And finally changing the plugins section of my .babelrc to this:
{
"presets": ["react-native"],
"plugins": [
["#babel/plugin-proposal-decorators", {"legacy": true}]
]
}

Plugin/Preset files are not allowed to export objects, only functions

I'm getting this error after updating react-native to "^0.56.0":
bundling failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/ben/vepo/frontend/node_modules/babel-preset-flow/lib/index.js
I tried to do something similar to the highest voted answer here but instead for babel-preset-flow:
https://github.com/babel/babel-loader/issues/540
.babelrc:
"presets": ["react-native", "flow", "#babel/preset-flow"]
package.json
{
"name": "vepo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"rnpm": {
"assets": [
"./app/fonts"
]
},
"jest": {
"preset": "react-native",
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
}
},
"dependencies": {
"#babel/preset-flow": "^7.0.0-beta.52",
"#babel/preset-react": "^7.0.0-beta.52",
"babel-preset-react-native": "^4.0.0",
"flow-typed": "^2.4.0",
"generator-rn-toolbox": "^2.2.0",
"imagemagick": "^0.1.3",
"immutable": "4.0.0-rc.9",
"metro-bundler": "^0.22.1",
"native-base": "^2.3.3",
"prop-types": "^15.5.10",
"react": "16.3.1",
"react-native": "^0.56.0",
"react-native-aws3": "^0.0.8",
"react-native-blur": "^3.1.3",
"react-native-communications": "^2.2.1",
"react-native-drawer": "^2.3.0",
"react-native-fbsdk": "facebook/react-native-fbsdk#065507a",
"react-native-git-upgrade": "^0.2.7",
"react-native-image-picker": "^0.26.7",
"react-native-interactable": "^0.1.2",
"react-native-mail": "^3.0.2",
"react-native-maps": "^0.16.4",
"react-native-modal": "^2.3.2",
"react-native-modalbox": "^1.3.9",
"react-native-multiple-choice": "^0.0.8",
"react-native-navigation": "^1.1.100",
"react-native-off-canvas-menu": "^0.1.31",
"react-native-optimized-flatlist": "^1.0.1",
"react-native-redux-router": "^1.0.7",
"react-native-select-multiple": "^1.0.3",
"react-native-side-menu": "^0.20.1",
"react-native-vector-icons": "^4.4.0",
"react-navigation": "^1.0.0-beta.11",
"react-redux": "^5.0.3",
"redux": "^3.6.0",
"redux-immutable": "^4.0.0",
"redux-observable": "^0.14.1",
"reselect": "^3.0.0",
"rxjs": "^5.2.0",
"yarn": "^1.3.2",
"yoga": "^0.0.0"
},
"devDependencies": {
"adm-zip": "^0.4.7",
"babel-cli": "^6.26.0",
"babel-eslint": "^7.1.1",
"babel-plugin-module-resolver": "^2.7.0",
"eslint": "^3.17.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-flowtype": "^2.30.3",
"eslint-plugin-jsx": "^0.0.2",
"eslint-plugin-react": "^6.10.0",
"eslint-plugin-react-native": "^2.3.1",
"flow-bin": "^0.72.0",
"plist": "^2.1.0",
"react-devtools": "^3.2.1",
"react-test-renderer": "~15.4.1",
"redux-devtools": "^3.3.2",
"remote-redux-devtools": "^0.5.7",
"remotedev-server": "^0.2.4",
"xcode": "^1.0.0"
}
}
Nothing is working. Any ideas?
EDIT: there is no node_modules/babel-preset-flow folder at all
I had the same error and resolved it by uninstalling babel-preset-flow and installing #babel/preset-flow. I believe this is due to React Native 56 using Babel 7. And add to .babelrc
{
"presets": ["#babel/preset-flow"]
}
Upgrade your babel-preset-react-native dependency.
"babel-preset-react-native": "^5",
You don't need to have #babel/preset-react or #babel/preset-flow installed.
Hope this helps.
Open .babelrc file and then edit the presets section of the code as follows:
"presets": ["module:metro-react-native-babel-preset"],
I solved this issue by installing "babel-preset-react-native-stage-0" in my project and changed .babelrc file:
"presets": [
"babel-preset-react-native-stage-0/decorator-support"
]
for Babel 7 and above and according to this document create a file with name bable.config.js instead of .babelrc and then export presets like this :
const presets = [
"flow"
]
module.exports = {presets}