我是新手,在这里遇到了一个问题。每当我尝试使用npm start运行我的react应用程序时,我都会得到这些错误
events.js:352
throw er; // Unhandled 'error' event
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/home/nrj/Documents/react/counter-app/public/favicon.ico'
at FSWatcher.<computed> (internal/fs/watchers.js:218:26)
at Object.watch (fs.js:1582:34)
at createFsWatchInstance (/home/nrj/Documents/react/counter-app/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:38:15)
at setFsWatchListener (/home/nrj/Documents/react/counter-app/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/nrj/Documents/react/counter-app/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:233:14)
at FSWatcher.NodeFsHandler._handleFile (/home/nrj/Documents/react/counter-app/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:262:21)
at FSWatcher.<anonymous> (/home/nrj/Documents/react/counter-app/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:495:21)
at FSReqCallback.oncomplete (fs.js:193:5)
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (/home/nrj/Documents/react/counter-app/node_modules/webpack-dev-server/node_modules/chokidar/index.js:260:10)
at createFsWatchInstance (/home/nrj/Documents/react/counter-app/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:40:5)
at setFsWatchListener (/home/nrj/Documents/react/counter-app/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15)
[... lines matching original stack trace ...]
at FSReqCallback.oncomplete (fs.js:193:5) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '/home/nrj/Documents/react/counter-app/public/favicon.ico',
filename: '/home/nrj/Documents/react/counter-app/public/favicon.ico'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! counter-app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the counter-app@0.1.0 start 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! /home/nrj/.npm/_logs/2021-07-29T09_59_36_829Z-debug.log
我看到了一些解决方案,如更新node.js,删除node_modules和运行npm install,但它们对我不起作用。
如果您在Linux上运行,那么看起来您已经耗尽了观察者的限制
试试下面的说明:https://stackoverflow.com/a/55411444/2799454