React Native: EMFILE: too many open files WITH WATCHMAN - node.js

I've been setting up a new M1 MacBook Air with my RN project and have been getting this error in Xcode despite having watchdog installed with homebrew:
+ node /Users/USERNAMAE/RNAPP/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev true --reset-cache --bundle-output /Users/USERNAME/Library/Developer/Xcode/DerivedData/RNAPP-dkmyfsbkdgxjzccgsexwkuiqxsnz/Build/Products/Debug-iphoneos/ReLearn.app/main.jsbundle --assets-dest /Users/USERNAME/Library/Developer/Xcode/DerivedData/RNAPP-dkmyfsbkdgxjzccgsexwkuiqxsnz/Build/Products/Debug-iphoneos/RNAPP.app
warning: the transform cache was reset.
Welcome to React Native!
Learn once, write anywhere
events.js:352
throw er; // Unhandled 'error' event
^
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:178:28)
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.checkedEmitError (/Users/USERNAME/RNAPP/node_modules/sane/src/node_watcher.js:143:12)
at FSWatcher.emit (events.js:375:28)
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:184:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
}
+ [[ true != true ]]
Welcome to React Native!
Learn once, write anywhere
events.js:352
throw er; // Unhandled 'error' event
^
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:178:28)
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.checkedEmitError (/Users/username/RNApp/node_modules/sane/src/node_watcher.js:143:12)
at FSWatcher.emit (events.js:375:28)
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:184:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
I tried both Node#16 and Node#14.

Related

nodejs graphviz: graph.output() converter giving error during DOT to PNG conversion

graphviz = require('graphviz');
var g = graphviz.digraph("G");
// Add node (ID: Hello)
var n1 = g.addNode( "Hello", {"color" : "blue"} );
n1.set( "style", "filled" );
// // Add node (ID: World)
g.addNode( "World" );
// // Add edge between the two nodes
var e = g.addEdge( n1, "World" );
e.set( "color", "red" );
// // Print the dot script
console.log( g.to_dot() );
g.setGraphVizPath("/usr/local/bin")
g.output("png", "test.png")
Error
node:events:490
throw er; // Unhandled 'error' event
^
Error: spawn dot 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 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: -2,
code: 'ENOENT',
syscall: 'spawn dot',
path: 'dot',
spawnargs: [ '-Tpng', '-otest.png' ]
}
Tried upgrading and downgrading node version, tried using rendererDot module for conversion, nothing worked. DOT file is not getting converted to SVG/PNG.

visual studio cannot open my project error npm start

i want to run and debuuging my project but i have this error
when i put npm start
/home/aymen/Téléchargements/app/node_modules/react-scripts/scripts/start.js:19
throw err;
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/home/aymen/Téléchargements/app/public'
at FSWatcher. (node:internal/fs/watchers:244:19)
at Object.watch (node:fs:2251:34)
at createFsWatchInstance (/home/aymen/Téléchargements/app/node_modules/chokidar/lib/nodefs-handler.js:119:15)
at setFsWatchListener (/home/aymen/Téléchargements/app/node_modules/chokidar/lib/nodefs-handler.js:166:15)
at NodeFsHandler._watchWithNodeFs (/home/aymen/Téléchargements/app/node_modules/chokidar/lib/nodefs-handler.js:331:14)
at NodeFsHandler._handleDir (/home/aymen/Téléchargements/app/node_modules/chokidar/lib/nodefs-handler.js:567:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async NodeFsHandler._addToNodeFs (/home/aymen/Téléchargements/app/node_modules/chokidar/lib/nodefs-handler.js:617:16)
at async /home/aymen/Téléchargements/app/node_modules/chokidar/index.js:451:21
at async Promise.all (index 0)
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (/home/aymen/Téléchargements/app/node_modules/chokidar/index.js:647:10)
at NodeFsHandler._addToNodeFs (/home/aymen/Téléchargements/app/node_modules/chokidar/lib/nodefs-handler.js:645:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /home/aymen/Téléchargements/app/node_modules/chokidar/index.js:451:21
at async Promise.all (index 0) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '/home/aymen/Téléchargements/app/public',
filename: '/home/aymen/Téléchargements/app/public'
If you are using Linux, your project is hitting your system's file watchers limit
To fix this, on your terminal, try:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

How to get PostgreSQL dump database file using Node JS

I tried to generate postgresql dump file using Node JS. SO, I used secure-backup library to generate pg-dump file encrypted. I add this package in my project and I configured .pem file also. When I execute this file it's throwing some error. but I couldn't understand what type error is throwing and how to fix it I don't know. Any one give some suggestion how to resolve this issue to generate pg dump file using Node JS otherwise different library used to generate pg dump file.
CODE
let secureBackup = require('secure-backup');
let pgHandler = require('secure-backup/lib/handlers/pg')
console.log('hi')
let backup = secureBackup({
pubKeyPath: 'C:/Users/DELL/Desktop/Twilio_Phone/cert.pem', // path to your public key
outputPath: 'C:/Users/DELL/Desktop/DB_Dump', // where to output your encrypted backup
compress: true, // enable compression (gzip)
handler: pgHandler({
user: 'postgres',
password: '*****',
database: '****'
})
})
backup() // can be invoked directly
// or used with a cron-job module like node-schedule
Error
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn pg_dump ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:465:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
at onErrorNT (internal/child_process.js:465:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn pg_dump',
path: 'pg_dump',
spawnargs: [ '-U', 'postgres', 'HP', 'hummapi' ]
}

Error: EMFILE: too many open files, open '/app/build/index.html'

Using Serve to serve my React app. It seems that too many people are reading the static files. but somehow it is not getting closed. Due to this the react app is crashing
events.js:177
throw er; // Unhandled 'error' event
^
Error: EMFILE: too many open files, open '/app/build/index.html'
Emitted 'error' event on ReadStream instance at:
    at internal/fs/streams.js:151:12
    at FSReqCallback.oncomplete (fs.js:155:23) {
  errno: -24,
  code: 'EMFILE',
  syscall: 'open',
  path: '/app/build/index.html'
}
Any suggestions??

Getting Error: spawn ./node_modules/.bin/grunt ENOENT when running grunt

I have a project that is started in development by
yarn start
It runs a index.js that starts a grunt process and get this error:
$ yarn start
yarn start v0.23.2
$ node ./development
grunt_arguments [ '--force', '--notify', '--verbose', '--debug', '--stack' ]
=======================================
Open http://localhost:8000 to start developing
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn ./node_modules/.bin/grunt ENOENT
at exports._errnoException (util.js:907:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:189:32)
at onErrorNT (internal/child_process.js:355:16)
at nextTickCallbackWith2Args (node.js:458:9)
at process._tickCallback (node.js:372:17)
at Function.Module.runMain (module.js:443:11)
at startup (node.js:139:18)
at node.js:990:3
error Command failed with exit code 1.
No idea what can it be. Environment is:
Win10
Running with MINGW64
I usually monkey patch child_process to help me debug that kind of issues. Add something like this in the beginning of your index.js file:
const util = require('util')
const childProcess = require("child_process");
const originalSpawn = childProcess.spawn;
childProcess.spawn = function() {
console.trace('SPAWN');
console.log('ARGS');
console.log(util.inspect(arguments, false, null)); // showHidden = false, depth = null
return originalSpawn.apply(this, arguments);
};
If your run, childProcess.spawn('ls', ['-lh', '/usr']) you will see something like:
Trace: SPAWN
at Object.childProcess.spawn (repl:2:9)
at myFunction (repl:2:14)
at repl:1:1
at REPLServer.defaultEval (repl.js:164:27)
at bound (domain.js:250:14)
at REPLServer.runBound [as eval] (domain.js:263:12)
at REPLServer.<anonymous> (repl.js:392:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
ARGS
{ '0': 'ls', '1': [ '-lh', '/usr' ] }
Maybe after running it you can update your question with the new information.

Resources