Home > Mobile >  npm run start with error "EMFILE: too many open files"
npm run start with error "EMFILE: too many open files"

Time:12-01

I done npm update and broke start project. Using npm run start returns an error:

10% building 0/1 entries 0/0 dependencies 0/0 modulesnode:internal/errors:484
    ErrorCaptureStackTrace(err);
    ^

Error: EMFILE: too many open files, watch
    at FSWatcher._handle.onchange (node:internal/fs/watchers:204:21)
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (/Users/199/WebstormProjects/isu_frontend_common/node_modules/chokidar/index.js:647:10)
    at NodeFsHandler._boundHandleError (/Users/199/WebstormProjects/isu_frontend_common/node_modules/chokidar/lib/nodefs-handler.js:303:43)
    at /Users/199/WebstormProjects/isu_frontend_common/node_modules/chokidar/lib/nodefs-handler.js:137:5
    at foreach (/Users/199/WebstormProjects/isu_frontend_common/node_modules/chokidar/lib/nodefs-handler.js:41:5)
    at fsWatchBroadcast (/Users/199/WebstormProjects/isu_frontend_common/node_modules/chokidar/lib/nodefs-handler.js:136:3)
    at FSWatcher.<anonymous> (/Users/199/WebstormProjects/isu_frontend_common/node_modules/chokidar/lib/nodefs-handler.js:185:9)
    at FSWatcher.emit (node:events:513:28)
    at FSWatcher._handle.onchange (node:internal/fs/watchers:210:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}

Node.js v18.12.1

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

RpcIpcMessagePortClosedError: Cannot send the message - the message port has been closed for the process 17332.


I've already tried:

  • Removing node_modules and package-lock.json, clean cache and npm install
  • Switch Node.js and NPM versions to lastest stable
  • Installing the project again in another folder

But it didn't help me. What else can I do?

CodePudding user response:

Judging of your filepath's it seems like you are using MacOS. I have experienced this issue a few times on my macbook m1 silicone and was able to resolve this issue by installing Watchman. You can simply do that with the help of brew.

First update brew;

brew update

then execute this command;

brew install watchman

Let me know if this solved your issue.

CodePudding user response:

npm install graceful-fs

It resolve my problem.

  • Related