Cannot read property 'transformFile' of undefined exception vue-native - android

I just wanted to try vue-native. However I get this error.
bundling failed: TypeError: Cannot read property 'transformFile' of undefined
Here is my package.json file
{
"name": "vueNativeDeneme",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.10",
"vue-native-core": "^0.1.4",
"vue-native-helper": "^0.1.4"
},
"devDependencies": {
"#babel/core": "7.6.4",
"#babel/runtime": "7.6.3",
"babel-jest": "24.9.0",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.56.3",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
How can I fix this?

Change your devDependencies:
"devDependencies":{
"#babel/core": "^7.0.0",
"#babel/preset-env": "^2.0.0-alpha.20",
"babel-preset-expo": "~8.0.0",
"vue-native-scripts": "0.0.16"
},
Problem solved.

Related

I can not build React Native Project in Release Mode

React Native 0.70.1 Build in debug Mode, when i try to build in release mode, I get the below error.error message.
My package.json
{
"name": "xxxxxx",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-navigation/native": "^6.1.1",
"#react-navigation/native-stack": "^6.9.6",
"moment": "^2.29.4",
"react": "18.1.0",
"react-native": "0.70.6",
"react-native-image-picker": "^4.10.2",
"react-native-paper": "^5.0.1",
"react-native-raw-bottom-sheet": "^2.2.0",
"react-native-safe-area-context": "^4.5.0",
"react-native-screens": "^3.18.0",
"react-native-svg": "^13.7.0",
"react-native-vector-icons": "^9.2.0",
"rtn-fetch-module": "file:RTNFetchModule"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "0.72.3",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "18.1.0"
},
"jest": {
"preset": "react-native"
}
}
I am trying to build react-native in release mode.
Add multidex in /android/app/build.gradle file
android {
defaultConfig {
// ...
multiDexEnabled true // <-- ADD THIS in the defaultConfig section
}
// ...
}
dependencies {
implementation 'androidx.multidex:multidex:2.0.1' // <-- ADD THIS DEPENDENCY
}
Then in android/app/src/main/java/.../MainApplication.java
// ... all your other imports here
import androidx.multidex.MultiDexApplication; // <-- ADD THIS IMPORT
// Your class definition needs `extends MultiDexApplication` like below
public class MainApplication extends MultiDexApplication implements ReactApplication {
Once added, rebuild your application: npx react-native run-android.

Revision not found in React-Native,Android

I'm trying to debug my app on my android phone. When i first build my app with:
sudo react-native run-android
It builds perfectly, but when I changed my code and saved, it doesn't reload and I need to build over and over again with every change. HMR is active, and tried to press 'Reload' on my Dev Menu, but it doesn't reload. Here is extra information:
using Visual Studio Code.
Android version of my phone: 6.0.1
Connection:Via USB.
USB Debugging:Enabled and Allowed to this computer.
using Linux.
.babelrc
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": ["#babel/proposal-class-properties"]
}
package.json
{
"name": "hiworld",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"global": "^4.3.2",
"react": "16.6.1",
"react-native": "0.57.7"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^10.0.1",
"babel-jest": "23.6.0",
"babel-preset-flow": "^6.23.0",
"eslint": "^5.9.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.11.1",
"eslint-plugin-standard": "^4.0.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.50.0",
"react-test-renderer": "16.6.1"
},
"jest": {
"preset": "react-native"
},
"main": "index.js",
"author": "",
"license": "ISC",
"description": ""
}
if you need anything else, i'll edit this post.

react native released apk crush on launch

i get no errors when i compile the APK in release but after i install it it crashes instant on load. Here are my packages:
{
"name": "etwow_rent",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"#babel/runtime": "^7.1.2",
"bundle": "^2.1.0",
"haversine": "^1.1.0",
"react": "16.5.0",
"react-native": "^0.57.1",
"react-native-camera": "^1.3.0",
"react-native-maps": "^0.22.0",
"react-native-qrcode-scanner": "^1.1.0",
"react-navigation": "^2.18.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.48.0",
"react-native-bundle": "0.0.4",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
}
maybe you forgot one of the steps for generating Signed APK ,Here is full Documentation of Generating Signed APK https://facebook.github.io/react-native/docs/signed-apk-android
You can go through it.

how to import the eth-lightwallet package to the react-native project?

First, I created a project: react-native init project, and
when I try to import * as lightwallet from 'eth-lightwallet' in my react-native project, I get an error see this image
Found a solution at github, but this did not solve the problem for me.
My package.json:
{
"name": "androidWallet",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"asn1": "^0.2.3",
"buffer": "^5.2.0",
"eth-lightwallet": "^3.0.1",
"history": "^4.7.2",
"native-base": "^2.7.2",
"node-libs-browser": "^2.1.0",
"node-libs-react-native": "^1.0.2",
"react": "16.4.1",
"react-native": "0.55.2",
"react-native-table-component": "^1.1.8",
"react-navigation": "^2.9.3",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"react-router-redux": "^4.0.8",
"redux": "^4.0.0",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"web3": "^0.20.6"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-jest": "23.4.2",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react-native": "4",
"jest": "23.4.2",
"react-test-renderer": "16.4.1"
},
"jest": {
"preset": "react-native"
}
}
The problem is that the eth-lightwallet depends on node core modules that isn't supported by React Native out of the box. The current workaround involves using
rn-nodeify in order to provide shims for React Native to use instead. See this issue for react native and see this open issue from eth-lightwallet.

Babel error when running ./gradlew assembleRelease

I receive this error after running ./gradlew assembleRelease:
Plugin/Preset files are not allowed to export objects, only functions.
In C:\..\node_modules\babel-preset-expo\index.js
:app:bundleReleaseJsAndAssets FAILED
**FAILURE: Build failed with an exception.**
This is what I have in package.json file:
{
"name": "Mascota24",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-preset-stage-0": "^6.24.1",
"react-test-renderer": "16.3.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "jest"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"#babel/preset-react": "^7.0.0-beta.53",
"babel-preset-env": "^1.7.0",
"babel-preset-expo": "^4.0.0",
"babel-preset-react": "^6.24.1",
"babel-preset-react-native": "^2.1.0",
"babel-preset-react-native-stage-0": "^1.0.1",
"react": "16.3.1",
"react-native": "^0.56.0",
"react-native-circle-checkbox": "^0.1.6",
"react-native-modal": "^6.4.0",
"react-native-phone-call": "^1.0.7",
"react-navigation": "^2.6.2",
"react-redux": "^5.0.7",
"redux-thunk": "^2.3.0"
}
}
And this is .babelrc file:
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}
I've followed almost every post here related with this and none of them helped me :( Thanks for any help
Thanks to #ashutosh pandey for the help, I changed react-native version to:
"react-native": "^0.55"
Then I installed redux and could generate the .apk! :D

Categories

Resources