bundling failed: Error and 404 when running React-Native project - android

I have a React-Native application which I'm running with npm start -- --reset-cache. Then I run react-native run-android.
However, I'm getting this issue in the console of the npm server:
Bundling `index.js` [development, non-minified] 0.0% (0/1), failed.
error: bundling failed: Error
at DependencyGraph._getAbsolutePath (/myProjectPath/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:305:11)
at DependencyGraph.getDependencies (/myProjectPath/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:283:4236)
at Resolver.getDependencies (/myProjectPath/node_modules/metro-bundler/src/Resolver/index.js:129:5)
at /myProjectPath/node_modules/metro-bundler/src/Bundler/index.js:642:39
at Generator.next (<anonymous>)
at step (/myProjectPath/node_modules/metro-bundler/src/Bundler/index.js:13:1336)
at /myProjectPath/node_modules/metro-bundler/src/Bundler/index.js:13:1496
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
And then, in the Android emulator, I'm getting:
The development server returned response error code: 404
URL: http//10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false
Body:
{"message": "Cannot find entry file index.js in any of the roots"
This confuses me. Why is it looking for index.js instead of index.android.js, since I am on an Android emulator?
Any idea about how I can fix this issue?

After version 0.49.1 index.android.js and index.ios.js files were merged into one file.
https://github.com/facebook/react-native/issues/16208
I understand that you will have to upgrade the applications in the old version.I guess this transition will be difficult.

Related

react native svg error child.isClassAccessorProperty is not a function on upgrading react native from 68.1 to 70.6

Thanks in advance
I received the below error when I tried to upgrade react native from 68.1 to 70.6.
I tried this in android.
I ran react-native run-android and everything went well.
Upon running the app the metro bundler started loading 99% and showed this error in red screen
error: node_modules/react-native-svg/src/elements/Shape.tsx: /Users/jarenk/Documents/myApp/node_modules/react-native-svg/src/elements/Shape.tsx: child.isClassAccessorProperty is not a function
Can anybody help me on this.
Am using react native SVG and its version was old. I updated it to latest version too.
(13.6.0) but still its getting same error.
Error In Detail (If I take Build)
./gradlew assembleRelease
I get following error
error node_modules/react-native-svg/src/elements/Shape.tsx: /Users/jarenk/Documents/myApp/node_modules/react-native-svg/src/elements/Shape.tsx: child.isClassAccessorProperty is not a function.
TypeError: /Users/jarenk/Documents/myApp/node_modules/react-native-svg/src/elements/Shape.tsx: child.isClassAccessorProperty is not a function
at /Users/jarenk/Documents/myApp/node_modules/#babel/plugin-transform-typescript/lib/index.js:361:89
at Array.forEach (<anonymous>)
at PluginPass.Class (/Users/jarenk/Documents/myApp/node_modules/#babel/plugin-transform-typescript/lib/index.js:353:31)
at newFn (/Users/jarenk/Documents/myApp/node_modules/#babel/traverse/lib/visitors.js:171:21)
at NodePath._call (/Users/jarenk/Documents/myApp/node_modules/#babel/traverse/lib/path/context.js:53:20)
at NodePath.call (/Users/jarenk/Documents/myApp/node_modules/#babel/traverse/lib/path/context.js:40:17)
at NodePath.visit (/Users/jarenk/Documents/myApp/node_modules/#babel/traverse/lib/path/context.js:90:31)
at TraversalContext.visitQueue (/Users/jarenk/Documents/myApp/node_modules/#babel/traverse/lib/context.js:110:16)
at TraversalContext.visitQueue (/Users/jarenk/Documents/myApp/node_modules/#babel/traverse/lib/context.js:116:21)
info Run CLI with --verbose flag for more details.
Once again thank you.
Updating the package.json file helped me to resolve this.
just downgrade the babel versions like below
Also make sure same below version are in package-lock.json file
"#babel/core": "7.12.9",
"#babel/runtime": "7.12.5"
To solve this issue, you need to delete the "node_modules" folder and run either
"yarn install" or
"npm install" command.
It is likely that you switched to a Git branch with a higher version of Babel, which is causing the problem.

Unable to apply changes on device: DEVICE####. Error is: Cannot read property 'env' of undefined

I get this issue after my first android build; then, before that, the project run in development in the device and even in an emulator. Also the error happens in the emulator too.
I has been researching about that. Update to the current last versions of NativeScript tns-android: 5.4.0 tns-core-modules: 5.4.3 nativescript-vue: 2.2.2, also update the firebase plugin nativescript-plugin-firebase: 9.0.1. And this doesn’t allows me to continue the project. I am so frustrated in this moment about this issue.
Unable to apply changes on device: DEVICE####.
Error is: Cannot read property 'env' of undefined.
Using the --log trace this is shown
Will emit event liveSyncError with data { error:
{ Error: Command ./gradlew failed with exit code 1
at Errors.fail (/Users/user/.nvm/versions/node/v8.14.1/lib/node_modules/nativescript/lib/common/errors.js:126:28)
at Errors.failWithoutHelp (/Users/user/.nvm/versions/node/v8.14.1/lib/node_modules/nativescript/lib/common/errors.js:136:21)
at AndroidProjectService.<anonymous> (/Users/user/.nvm/versions/node/v8.14.1/lib/node_modules/nativescript/lib/services/android-project-service.js:666:34)
at Generator.throw (<anonymous>)
at rejected (/Users/user/.nvm/versions/node/v8.14.1/lib/node_modules/nativescript/lib/services/android-project-service.js:11:65)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
name: 'Exception',
message: 'Command ./gradlew failed with exit code 1',
stack: 'Error: Command ./gradlew failed with exit code 1\n at Errors.fail (/Users/user/.nvm/versions/node/v8.14.1/lib/node_modules/nativescript/lib/common/errors.js:126:28)\n at Errors.failWithoutHelp (/Users/user/.nvm/versions/node/v8.14.1/lib/node_modules/nativescript/lib/common/errors.js:136:21)\n at AndroidProjectService.<anonymous> (/Users/user/.nvm/versions/node/v8.14.1/lib/node_modules/nativescript/lib/services/android-project-service.js:666:34)\n at Generator.throw (<anonymous>)\n at rejected (/Users/user/.nvm/versions/node/v8.14.1/lib/node_modules/nativescript/lib/services/android-project-service.js:11:65)\n at <anonymous>\n at process._tickCallback (internal/process/next_tick.js:189:7)',
errorCode: 127,
suppressCommandHelp: true,
proxyAuthenticationRequired: false,
printOnStdout: undefined },
.
.
.
Thanks in advance for any help, this has totally block the development of the project.
this error is expected if you are trying to use nativescript-dev-webpack#next with latest official version of NativeScript CLI (5.4.2) as they are not compatible with one another (preparing for NativeScript 6.0 release).
If you would like to use nativescript-dev-webpack#next you will need to install nativescript#next as well.
Hope this helps!

The development server returned response error code :500

I have just created a React Native application in Webstorm , but when i run it, it shows this error :
The development server returned response error code: 500
URL: http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false
Body:
{"message":"TransformError: F:\\MyApps\\CatalogueApp\\index.android.js: Unexpected token ) (While processing preset: \"F:\\\\MyApps\\\\CatalogueApp\\\\node_modules\\\\babel-preset-react-native\\\\index.js\")","type":"TransformError","lineNumber":0,"description":"","errors":[{"description":"","lineNumber":0}]}
processBundleResult
BundleDownloader.java:170
access$100
BundleDownloader.java:39
onResponse
BundleDownloader.java:139
execute
RealCall.java:135
run
NamedRunnable.java:32
runWorker
ThreadPoolExecutor.java:1113
run
ThreadPoolExecutor.java:588
run
Thread.java:818
Why ?
Below is the image :
This is what i did in the command prompt It helped me.
npm uninstall babel-preset-react-native
npm install babel-preset-react-native#2.1.0
It means the new version of babel-preset-react-native library and there is an unsupported trailing commas on that new version.
I had this problem. It resolved by correcting the code. Take a look at the node window that has opened when you ran "react-native run-android", It's reporting where's the problem, for example it reports:
Unexpected token (27:6)
and then it reports a part of your code that is making the error. Open up the App.js file, review the code part that has made the problem and correct it.
Take a look at the below picture and pay attention to the yellow part.

Ionic Package Build Android failed - dont understand error message

This is the error message:
Fetching plugin "cordova-plugin-device" via npm
shell.js: internal error
Error: ENOSPC, no space left on device '/home/package/workspace/apps-483d2a0c-2/cordova/plugins/cordova-plugin-device/src/blackberry10'
at Error (native)
at Object.fs.mkdirSync (fs.js:747:18)
at cpdirSyncRecursive (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/cp.js:58:8)
at cpdirSyncRecursive (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/cp.js:73:7)
at /usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/cp.js:180:9
at Array.forEach (native)
at Object._cp (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/cp.js:157:11)
at Object.cp (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/common.js:186:23)
at copyPlugin (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:289:15)
at /usr/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:159:27
working on cloud9. tried to package simple app.
Command was:
ionic package build android
can someone explain me what this error means?
The error means there is no space left on your disk (in cloud9).

react-native running tutorial 'AwesomeProject' on Android results in 'Unable to download JS Bundle' red screen

I am following this Facebook tutorial, and when running react-native run-android from AwesomeProject dir, I am getting a red screen on the android emulator, with the following text:
Unable to download JS bundle. Did you forget to start the development server or connect your device?
onResponse
DevServerHelper.java:175
run
NamedRunnable.java:33
runWorker
ThreadPoolExecutor.java:1113
run
ThreadPoolExecutor.java:588
run
Thread.java:818
I don't know if it's related, but I'm also getting a bunch of SyntaxErrors on the server regarding const not being valid in strict mode (I did not change anything in the original code) and getting the following error on START:
< START> request:/index.android.bundle?platform=android
TypeError: Cannot read property 'root' of null
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84
at tryCallOne (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:103:15
at flush (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
at process._tickCallback (node.js:355:11)
Update
Upgrading to Node v4.1.1 got rid of the const syntax error, but I still get the same result with the following error on React Packager:
TypeError: Cannot read property 'root' of null
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84
at tryCallOne (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:103:15
at flush (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
at process._tickCallback (node.js:355:11)
[5:02:20 PM] request:/index.android.bundle?platform=android
[5:02:20 PM] find dependencies
TypeError: Cannot read property 'root' of null
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84
at tryCallOne (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:103:15
at flush (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
at process._tickCallback (node.js:355:11)
[5:02:26 PM] request:/index.android.bundle?platform=android
I managed to solve the issue. To anyone else who encounters the issue, re-installing watchman did the trick for me:
brew uninstall watchman
brew install watchman
My app is now running
Also, I tried the Wathman install/uninstall route, with not much luck. What did work was making sure I updated and changed the version of node as used by nvm.
e.g. nvm install 4.1.1

Categories

Resources