chatbox
chatbox copied to clipboard
[BUG] 启动app时提示file watcher达到限制
Bug Description
我用的linux ubuntu,使用npm run dev命令启动app时提示
Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox'
具体log如下:
> [email protected] dev
> npm start
> [email protected] start
> ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer
> [email protected] start:renderer
> cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts
Starting preload.js builder...
Starting Main Process...
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:1212/
<i> [webpack-dev-server] Content not from webpack is served from '/root/tool/chatbox/public' directory
<i> [webpack-dev-server] 404s will fallback to '/index.html'
Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox'
at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
at Object.watch (node:fs:2418:34)
at createFsWatchInstance (/root/tool/chatbox/node_modules/chokidar/lib/nodefs-handler.js:119:15)
at setFsWatchListener (/root/tool/chatbox/node_modules/chokidar/lib/nodefs-handler.js:166:15)
at NodeFsHandler._watchWithNodeFs (/root/tool/chatbox/node_modules/chokidar/lib/nodefs-handler.js:331:14)
at NodeFsHandler._handleDir (/root/tool/chatbox/node_modules/chokidar/lib/nodefs-handler.js:567:19)
at NodeFsHandler._addToNodeFs (/root/tool/chatbox/node_modules/chokidar/lib/nodefs-handler.js:617:27)
at async /root/tool/chatbox/node_modules/chokidar/index.js:451:21
at async Promise.all (index 0) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '/root/tool/chatbox',
filename: '/root/tool/chatbox'
}
> [email protected] start:preload
> cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.preload.dev.ts
⠙
> [email protected] start:main
> cross-env NODE_ENV=development electronmon -r ts-node/register/transpile-only .
node:internal/errors:496
ErrorCaptureStackTrace(err);
^
Error: ENOENT: no such file or directory, watch
at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
at Object.watch (node:fs:2418:34)
at watchDir (/root/tool/chatbox/node_modules/watchboy/index.js:361:26)
at /root/tool/chatbox/node_modules/watchboy/index.js:394:12
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event at:
at /root/tool/chatbox/node_modules/watchboy/index.js:409:12
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -2,
syscall: 'watch',
code: 'ENOENT',
filename: ''
}
Node.js v18.20.7
[0221/203315.740084:FATAL:electron_main_delegate.cc(293)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox/src/main'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox/src'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox/node_modules'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox/node_modules/ts-loader'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox/src/main'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox/node_modules'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox/src'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox/node_modules/ts-loader'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox/src/main'
Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/root/tool/chatbox'
我的环境如下:
node -v v18.20.7
npm -v 10.8.2
由于是docker环境,更改系统的inotify很不方便,请问有其他解决办法吗