Daily Archives: 11.05.2017

Coding

Fix ENOSPC error

When we were starting up our React Native project, we got the following error message:


ERROR watch /home/phz/workspace/react-mobile/node_modules/beeper ENOSPC
{"code":"ENOSPC","errno":"ENOSPC","syscall":"watch /home/phz/workspace/react-mobile/node_modules/beeper","filename":"/home/phz/workspace/react-mobile/node_modules/beeper"}
Error: watch /home/phz/workspace/react-mobile/node_modules/beeper ENOSPC
at exports._errnoException (util.js:1018:11)
at FSWatcher.start (fs.js:1443:19)
at Object.fs.watch (fs.js:1470:11)
at NodeWatcher.watchdir (/home/phz/workspace/react-mobile/node_modules/sane/src/node_watcher.js:144:20)
at Walker.<anonymous> (/home/phz/workspace/react-mobile/node_modules/sane/src/node_watcher.js:353:12)
at emitTwo (events.js:106:13)
at Walker.emit (events.js:191:7)
at /home/phz/workspace/react-mobile/node_modules/walker/lib/walker.js:69:16
at go$readdir$cb (/home/phz/workspace/react-mobile/node_modules/graceful-fs/graceful-fs.js:149:14)
at FSReqWrap.oncomplete (fs.js:123:15)

We found out that the problem is caused by having too few filesystem watches. See

http://stackoverflow.com/questions/22475849/node-js-error-enospc

The issue can be fixed by increasing the fs.

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Published by: