Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when running watchman

When I run react-native start, I am getting the following message

Error: A non-recoverable condition has triggered. Watchman needs your help! The triggering condition was at timestamp=1489123194: inotify-add-watch(/var/www/html/eventManager/android/app/src/main/res/mipmap-mdpi) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl All requests will continue to fail with this message until you resolve the underlying problem. You will find more information on fixing this at https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch

at ChildProcess.<anonymous> (/var/www/html/bookLister/node_modules/fb-watchman/index.js:207:21)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Socket.<anonymous> (internal/child_process.js:323:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:492:12)
like image 734
Geethu Jose Avatar asked Mar 10 '17 05:03

Geethu Jose


People also ask

How do you run the watchman in react native?

You need to enable 'Live Reload'. On Physical device: Shake the device and then choose 'Enable Live Reload' from the menu. and then choose 'Enable Live Reload' from the menu.

What is watchman react native?

Watchman is an open source tool created by Facebook (https://facebook.github.io/watchman/). React Native's packager uses Watchman to recursively watch for changes to our source code files across one or more directory trees.


3 Answers

echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances
echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

watchman shutdown-server

This one helped

like image 194
Geethu Jose Avatar answered Oct 08 '22 04:10

Geethu Jose


Just run these commands in terminal:

echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances
echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
watchman shutdown-server  

Other Way make Script in package.json

"scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "flow": "flow",
    "flow-stop": "flow stop",
    "watch-need-help": "echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && watchman shutdown-server"
  },

Run following command on Terminal in project directory

npm run watch-need-help
like image 28
Syed Zain Ali Avatar answered Oct 08 '22 05:10

Syed Zain Ali


Increase inotify limit to increase the limit on the number of files you can monitor.

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

Please go through this for more info

like image 5
mad_greasemonkey Avatar answered Oct 08 '22 03:10

mad_greasemonkey