Build Failed in React Native and Getting java stackoverflowError as well - javascript

I am unable to solve this problem:
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
What went wrong:
java.lang.StackOverflowError (no error message)
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================
Get more help at https://help.gradle.org
BUILD FAILED in 26s
at makeError (C:\Users\Farhan Malik\Desktop\rnProjects\TechChloride\node_modules\execa\index.js:174:9)
at C:\Users\Farhan Malik\Desktop\rnProjects\TechChloride\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\Farhan Malik\Desktop\rnProjects\TechChloride\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7)
at async Command.handleAction (C:\Users\Farhan Malik\Desktop\rnProjects\TechChloride\node_modules\#react-native-community\cli\build\index.js:108:9)
info Run CLI with --verbose flag for more details.
I was trying to Run React NAtive newly created app on Emulator.

Related

I try to create a next.js webapp with vercel, but when i try to run vercel dev on cmd, it gave me this error

vercel dev
Vercel CLI 28.5.3
> Creating initial build
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn cmd.exe ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at cp.emit (C:\Users\IsWei\AppData\Roaming\npm\node_modules\vercel\node_modules\#vercel\build-utils\dist\index.js:17051:29)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn cmd.exe',
path: 'cmd.exe',
spawnargs: [ '/C', 'yarn run dev' ]
}
Node.js v19.1.0
Error: Builder exited with 1 before sending build result
I have run npm install -g vercel and when I try to run vercel dev on cmd, it gave me this error, I have on windows 10 64bit, i already check my environment veraible, here is what i did
added C:\Windows\System32\ and C:\Windows\System32\cmd.exe to both of the top and bottom environment variable Path, anyone help?
I also tried
yarn cache clean
yarn
yarn start
What I also did is to reinstall node, again it doesn't work.
I couldn't figure the "right way" to do it for a whole day,
what I ended up doing is creating a file named 'cmd.exe'.
I ran this command in cmd:
type "C:\Windows\system32\cmd.exe" > cmd.exe

The Android Studio Emulator is not working

I have installed React Native. The Android Studio Emulator is not working. I'm getting the following error. I'm sure I've installed React Native in all its details. I have watched installation videos over and over again. I couldn't solve the problem. Please could you help?
PS C:\Users\emrec\Masaüstü\ReactNative\bulutmd> npx react-native run-android
info Starting JS server...
info Installing the app...
:ReactNative:Unexpected empty result of running '[node, C:\Users\emrec\Masaüstü\ReactNative\bulutmd\node_modules\#react-native-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\emrec\Masaüstü\ReactNative\bulutmd\node_modules\#react-native-community\cli\build\bin.js, config]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\emrec\Masa�st�\ReactNative\bulutmd\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 413
* What went wrong:
A problem occurred evaluating script.
> node:internal/modules/cjs/loader:959 throw err; ^Error: Cannot find module 'C:\Users\emrec\Masaüstü\ReactNative\bulutmd\node_modules\#react-native-community\cli\build\bin.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15) at Function.Module._load (node:internal/modules/cjs/loader:804:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: []}
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BU�LD FAILED in 7s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
:ReactNative:Unexpected empty result of running '[node, C:\Users\emrec\Masaüstü\ReactNative\bulutmd\node_modules\#react-native-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\emrec\Masaüstü\ReactNative\bulutmd\node_modules\#react-native-community\cli\build\bin.js, config]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\emrec\Masa�st�\ReactNative\bulutmd\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 413
* What went wrong:
A problem occurred evaluating script.
> node:internal/modules/cjs/loader:959 throw err; ^Error: Cannot find module 'C:\Users\emrec\Masaüstü\ReactNative\bulutmd\node_modules\#react-native-community\cli\build\bin.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15) at Function.Module._load (node:internal/modules/cjs/loader:804:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: []}
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BU�LD FAILED in 7s
at makeError (C:\Users\emrec\Masaüstü\ReactNative\bulutmd\node_modules\execa\index.js:174:9)
at C:\Users\emrec\Masaüstü\ReactNative\bulutmd\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\emrec\Masaüstü\ReactNative\bulutmd\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\emrec\Masaüstü\ReactNative\bulutmd\node_modules\#react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.
PS C:\Users\emrec\Masaüstü\ReactNative\bulutmd>
uninstall #react-native-community library and restart the server

How to resolve EPERM: operation not permitted error in webpack command?

How to resolve EPERM: operation not permitted error in webpack command?
The following error message occurs when using webpack.
PS C:\Workspace\Mission> npm run dev
> webpack-demo#1.0.0 dev
> webpack --mode=development
[webpack-cli] [Error: EPERM: operation not permitted, open 'C:\Workspace\Mission\dist\px.bundle.js'] {
errno: -4048,
code: 'EPERM',
syscall: 'open',
path: 'C:\\Workspace\\Mission\\dist\\px.bundle.js'
}
Running the npm cache clean --force command works fine.
However, if I run the npm run dev command 3 or 4 times, the same error repeats again.
I gave the account admin rights, and I also gave full control to the folder. I tried running it in admin mode, but it didn't work.
How to fix this error?

Getting Error after installing react native firebase storage

So I was working with my React Native application and had to install react-native firebase storage for image storing. So I ran npm install #react-native-firebase/storage after installing it I re-run my server and after that, I am getting this error. I don't know why I am getting this error. Kindly help me out.
Getting this error:
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
F:\Salvador\node_modules\#react-native-firebase\storage\android\src\main\java\io\invertase\firebase\storage\ReactNativeFirebaseStorageModule.java:234: error: cannot find symbol
firebaseStorage.useEmulator(host, port);
^
symbol: method useEmulator(String,int)
location: variable firebaseStorage of type FirebaseStorage
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-firebase_storage:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
at makeError (F:\Salvador\node_modules\execa\index.js:174:9)
at F:\Salvador\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (F:\Salvador\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (F:\Salvador\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.
When I run my server I get this error
info Run CLI with --verbose flag for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Salvador#0.0.1 android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Salvador#0.0.1 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Home\AppData\Roaming\npm-cache\_logs\2021-06-02T14_16_46_571Z-debug.log
If anyone else is getting this error what you need to do is open your react native android folder in Android Studio and then build and run your application via Android Studio. It will successfully run the project after that close Android Studio and now again start your react native project.
Now you will get 0 errors.
Also, run npm outdated after running that try upgrading your outdated packages also as my storage version was 12.0 but auth and app of firebase was 11.2.

npm: command not found when executing commands in Electron app

I'm working on an electron app and within the app, I execute shell commands using child_process.exec. One of the commands I run is npm run start; this works perfectly in a dev environment but when I build the application for production all npm commands fail with showing the following error:
Error: Command failed: npm run start
/bin/sh: npm: command not found
at ChildProcess.exithandler (child_process.js:287)
at emitTwo (events.js:126)
at ChildProcess.emit (events.js:214)
at maybeClose (internal/child_process.js:925)
at Socket.stream.socket.on (internal/child_process.js:346)
at emitOne (events.js:116)
at Socket.emit (events.js:211)
at Pipe._handle.close [as _onclose] (net.js:554)
I tried running the application in debug mode by running the following command open MyApp.app/Contents/MacOS/MyApp and the npm commands run successfully with no errors.
What could be the issue?
The issue that the environment variable of $PATH is wrong inside the packaged app, it works in development because the application is launched from the terminal which gives it access to the $BASH profile.
To solve this problem I used this package fix-path. I installed the package and added the following snippet at the top of the file
if (process.env.NODE_ENV === 'production') {
const fixPath = require('fix-path');
fixPath();
}
I came to this answer after going through this issue on GitHub. Thanks to #Seblor

Categories

Resources