React Native - Command PhaseScriptExecution failed with a nonzero exit code - react-native

I'm getting this issue when I try to get archive.
I got react-native 0.63,
I got expo, expo-cli.
I tried to reinstall pod, removed nodule modules and reinstall etc.
what could be the solution?
info Writing bundle output to:, /Users/tufancagkansokmen/Library/Developer/Xcode/DerivedData/lastsisapp-gtlfysxutnqqnrbbwrcxtyldvttq/Build/Intermediates.noindex/ArchiveIntermediates/lastsisapp/BuildProductsPath/Release-iphoneos/lastsisapp.app/main.jsbundle
info Done writing bundle output
info Copying 76 asset files
info Done copying assets
+ [[ false != true ]]
+ [[ ! -f /Users/tufancagkansokmen/Library/Developer/Xcode/DerivedData/lastsisapp-gtlfysxutnqqnrbbwrcxtyldvttq/Build/Intermediates.noindex/ArchiveIntermediates/lastsisapp/BuildProductsPath/Release-iphoneos/lastsisapp.app/main.jsbundle ]]
Welcome to React Native!
Learn once, write anywhere
node:events:306
throw er; // Unhandled 'error' event
^
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:178:28)
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.checkedEmitError (/Users/tufancagkansokmen/works/lastsis-app/node_modules/sane/src/node_watcher.js:143:12)
at FSWatcher.emit (node:events:329:20)
at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:184:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
}
Command PhaseScriptExecution failed with a nonzero exit code

try to reinstall watchman. For me this one worked.
brew reinstall watchman
But you can try also these.
brew update
brew install watchman

I had similar errors. Deleting yarn.lock file and running
yarn install
fixed the problem.

Related

webpack-cli : Error: spawn Unknown system error -86 / Symfony

I have just acquired a new mac with M1 chip and I wonder if the error is related to this, because on my old one I have no problem.
[webpack-cli] Error: spawn Unknown system error -86
at ChildProcess.spawn (node:internal/child_process:412:11)
at spawn (node:child_process:698:9)
at Object.execFile (node:child_process:325:17)
at Object.module.exports.fileCommandJson (/Users/mlc/Sites/ImapImport/node_modules/node-notifier/lib/utils.js:88:13)
at NotificationCenter.notifyRaw (/Users/mlc/Sites/ImapImport/node_modules/node-notifier/notifiers/notificationcenter.js:81:11)
at WebpackNotifierPlugin.compilationDone (/Users/mlc/Sites/ImapImport/node_modules/webpack-notifier/index.js:129:14)
at Hook.eval [as callAsync] (eval at create (/Users/mlc/Sites/ImapImport/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:18:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/mlc/Sites/ImapImport/node_modules/tapable/lib/Hook.js:18:14)
at /Users/mlc/Sites/ImapImport/node_modules/webpack/lib/Compiler.js:498:23
at Compiler.emitRecords (/Users/mlc/Sites/ImapImport/node_modules/webpack/lib/Compiler.js:906:5) {
errno: -86,
code: 'Unknown system error -86',
syscall: 'spawn'
}
It occurs when the command is launched:
npm run dev
or
yarn encore dev
I have already tried deleting the node_modules file as well as the package-lock.json, and clearing the npm cache then re-running npm install but nothing worked.
Suggestions ?
Today I got my new M1 Pro as well and I had the same issue. The interesting thing is that the npm run prod created all files correctly.
First I checked if xcode-select --install is installed - it was.
Next I checked the installed git version git --version -> git version 2.32.0 (Apple Git-132), standard Apple git. I installed a fresh git via homebrew brew install git and restarted my Mac. After that the error was gone.
If this does not fix your error, maybe it is an weird npm package.
Problem solved, thanks to #andreasm for pointing me in the right direction.
I explain myself after checking on xcode was installed with the command :
xcode-select -p
it was, so I did not carry more attention than that, today just out of curiosity by executing :
xcode-select --install
the error has disappeared, morality: Do not trust the first command.

React Native: The development server returned response error code: 500

I tried to run my application on the emulator, the build is successfully done but when the app starts to bundle on about 26% this error pops up to the cmd:
[Mon Nov 08 2021 13:00:11.720] BUNDLE ./index.js
error: TypeError: Cannot read properties of undefined (reading 'reduce')
at resolveDependencies (C:\Users\iarch\Desktop\Directik App\mobile-v2-new\node_modules\metro\src\DeltaBundler\traverseDependencies.js:586:33)
at C:\Users\iarch\Desktop\Directik App\mobile-v2-new\node_modules\metro\src\DeltaBundler\traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (C:\Users\iarch\Desktop\Directik App\mobile-v2-new\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)
at _next (C:\Users\iarch\Desktop\Directik App\mobile-v2-new\node_modules\metro\src\DeltaBundler\traverseDependencies.js:107:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
and on the emulator splash screen shows up and then red screen appears:
i tried to solve with this versions of node:
17.0.1
16.13.0
16.10.0
14.18.1
and for every single one, I delete node_modules folder and then change my node version with nvs and afterward I run npm install but same thig happened.
how can I solve this?
for me this was due to the way I run project on emulator.
if you just run npm run android and wait for bundler to show up on another terminal,try this:
open up a terminal and run npm start on it wait for the react logo to show up.
then open another terminal and npm run android.
I don't know why but this worked in my case.
It's Javascript code error very often found when we are connecting API's and the server is damaged/down so... Useful link is below I found help in Mozila Docx
6.6.1. 500 Internal Server Error
The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. Reference Document
https://httpwg.org/specs/rfc7231.html#status.500
You may try restarting the bundler without caches:
npm start -- --reset-cache
If this doesn't work, you may need to clear everything and restart the server from there:
watchman watch-del-all &&
rm -rf $TMPDIR/react-native-packager-cache-* &&
rm -rf $TMPDIR/metro-bundler-cache-* &&
rm -rf node_modules/
&& npm cache clean --force &&
npm install &&
npm start -- --reset-cache
Taken from: How to clear react-native cache?
If nothing else works, are you sure you don't have an error in your code?
You first nedd to install react native community by given command
npm i #react-native-community/cli
Then you need you install react-timer-mixin as they help us to develop a faster responced server
npm install react-timer-mixin
This might solve your issue

react native init failed

whenever I create a new project then it throws the following Error. I did update any settings. everything was working fine before yesterday. Here is my issue.
[1/4] Resolving packages...
error Couldn't find package **"#typescript-eslint/parser#^4.22.1"** required by **"#react-native-community/eslint-config"** on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
E:\example\project\node_modules\execa\index.js:174
err = new Error(`Command failed: ${joinedCmd}${output}`);
^
Error: Command failed: yarn add -D #babel/core #babel/runtime #react-native-community/eslint-config eslint jest babel-jest metro-react-native-babel-preset react-test-renderer#17.0.1
at makeError (E:\example\project\node_modules\execa\index.js:174:9)
at E:\example\project\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async generateProject (E:\example\project\node_modules\#react-native-community\cli\build\commands\init\initCompat.js:128:3)
at async Object.initCompat (E:\example\project\node_modules\#react-native-community\cli\build\commands\init\initCompat.js:105:3) {
code: 1,
stdout: null,
stderr: null,
failed: true,
signal: null,
cmd: 'yarn add -D #babel/core #babel/runtime #react-native-community/eslint-config eslint jest babel-jest metro-react-native-babel-preset react-test-renderer#17.0.1',
timedOut: false,
killed: false
}
I did all remove a node, update node, removed react-native-CLI, and update it and it was fixed for some time. but I was unable to install any package.
it's now day 2 and I am stuck here.
before running react-native init try running npm install #typescript-eslint/parser#^4.22.1 I hope it resolves the issue.
if the issue persists try clearing cache with:
npm cache clean --force
Finally after search for a long time. I found a solution. just go to the network setting and turn off automatic proxy setting detection.

Error running react-native start on project after expo eject

I just ejected my project from Expo using expo eject, and when I try to run it using react-native start, I get the following error message in my Terminal:
events.js:287
throw er; // Unhandled 'error' event
^
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:127:28)
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.checkedEmitError (/usr/local/lib/node_modules/react-native/node_modules/sane/src/node_watcher.js:143:12)
at FSWatcher.emit (events.js:310:20)
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:133:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
}
I can't make out what I need to know to resolve this issue, so can someone point out the proper steps I should take to get my project running on react-native? Thanks!
Run the following in your command line to install watchman:
brew update
brew install watchman
try installing watchman - this improves on file watching capabilities of the react native packager server. see: https://facebook.github.io/watchman/

React native failed to upgrade : fatal: working tree '.' already exists

I tried to upgrade react native version from 0.41 to 0.44 using these instructions, but I got this error :
error Command failed.
Exit code: 128
Command: git
Arguments: clone https://github.com/lwansbrough/react-native-camera.git /Users/abdelnacer/Library/Caches/Yarn/v1/.tmp/264e7f98ae7b8a32797877705f218964
Directory: /Users/abdelnacer/work/react/DuluxTradePoints
Output:
fatal: working tree '.' already exists.
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Command 'yarn add react-native#0.42.0' exited with code 1:
stderr: undefinederror Command failed.
Exit code: 128
Command: git
Arguments: clone https://github.com/lwansbrough/react-native-camera.git /Users/abdelnacer/Library/Caches/Yarn/v1/.tmp/264e7f98ae7b8a32797877705f218964
Directory: /Users/abdelnacer/work/react/DuluxTradePoints
Output:
fatal: working tree '.' already exists.
stdout: yarn add v0.24.5
[1/4] Resolving packages...
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
at ChildProcess.child.on.code (/usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:58:18)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
git-upgrade ERR! Restore initial sources
Note: checking out 'project-snapshot'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 4c8828d... Project snapshot
May be someone have any ideas what I'm doing wrong?
I tried several yarn + react-native-git-upgrade but it didn't work for me
To make the upgrade work I had to remove the node_modules and clean the yarn cache too.
1) Remove node_modules:
rm -rf ./node_modules
2) Clean yarn cache
rm -rf /Users/<myUsername>/Library/Caches/Yarn/v1/.tmp
yarn cache clean
I am not sure if it would have worked with running just the removal of .tmp
3) Run yarn
4) Run upgrade again
react-native-git-upgrade
Note: My upgrade was from 0.51.0 to 0.53.3
facing the same issue,
try to run
yarn
then
react-native-git-upgrade
or
it might help you :
https://github.com/facebook/react-native/issues/11578#issuecomment-278022460