React-scripts has unexpectedly closed (exit code 1)

when i run ionic serve, i get this :

react-scripts start
[react-scripts] :information_source: 「wds」: Project is running at http://192.168.43.160/
[react-scripts] :information_source: 「wds」: webpack output is served from
[react-scripts] :information_source: 「wds」: Content not from webpack is served from /home/epsilon/lab/mobile/myApp/public
[react-scripts] :information_source: 「wds」: 404s will fallback to /
[react-scripts] Starting the development server…
[react-scripts]
[react-scripts] events.js:292
[react-scripts] throw er; // Unhandled ‘error’ event
[react-scripts] ^
[react-scripts] Error: ENOSPC: System limit for number of file watchers reached, watch ‘/home/epsilon/lab/mobile/myApp/public/assets/icon’
[react-scripts] at FSWatcher.start (internal/fs/watchers.js:169:26)
[react-scripts] at Object.watch (fs.js:1415:11)
[react-scripts] at createFsWatchInstance (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:38:15)
[react-scripts] at setFsWatchListener (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15)
[react-scripts] at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:233:14)
[react-scripts] at FSWatcher.NodeFsHandler._handleDir (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:429:19)
[react-scripts] at FSWatcher. (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:477:19)
[react-scripts] at FSWatcher. (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:482:16)
[react-scripts] at FSReqCallback.oncomplete (fs.js:168:5)
[react-scripts] Emitted ‘error’ event on FSWatcher instance at:
[react-scripts] at FSWatcher._handleError (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/index.js:260:10)
[react-scripts] at createFsWatchInstance (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:40:5)
[react-scripts] at setFsWatchListener (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15)
[react-scripts] [… lines matching original stack trace …]
[react-scripts] at FSReqCallback.oncomplete (fs.js:168:5) {
[react-scripts] errno: -28,
[react-scripts] syscall: ‘watch’,
[react-scripts] code: ‘ENOSPC’,
[react-scripts] path: ‘/home/epsilon/lab/mobile/myApp/public/assets/icon’,
[react-scripts] filename: ‘/home/epsilon/lab/mobile/myApp/public/assets/icon’
[react-scripts] }

[ERROR] react-scripts has unexpectedly closed (exit code 1).

    The Ionic CLI will exit. Please check any output above for error details.

i’m beginner in ionic, some one can help me ?

Are you on Linux? You probably need to increase the amount of inotify watchers.

(This is not specific to Ionic by the way, it’s the same for e.g. Create React App projects.)

1 Like

i’m working in linux (ubuntu 18.04).

thanks, it works now

I had the same problem as @Dony19 and after following the link you shared I was able to fix it. Thanks @mirkonasato