I'm on Ubuntu 15.10 and I am developing an Android (SDK 23) app using react-native (0.20.0). I'm using node 5.6.0 and npm 3.6.0.
I encountered a watchman error when running react-native start
ERROR watchman--no-pretty get-sockname returned with exit code 127 watchman:
error while loading shared libraries: libpcre.so.1: cannot open shared object
file: No such file or directory
at ChildProcess.<anonymous> (/home/rachael/Dev/InstaGo/node_modules/fb-watchman/index.js:198:18)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at maybeClose (internal/child_process.js:827:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at Pipe._onclose (net.js:471:12)
When I run sudo find / -name libpcre.so.1 the following is returned:
/home/rachael/.linuxbrew/lib/libpcre.so.1
/home/rachael/.linuxbrew/Cellar/pcre/8.38/lib/libpcre.so.1
I've tried reinstalling watchman:
make uninstall
git clone https://github.com/facebook/watchman.git
cd watchman
git checkout v4.1.0 # the latest stable release .
/autogen.sh
./configure
make
sudo make install
I also tried it with linuxbrew:
npm r -g watchman
brew update && brew upgrade
brew install watchman
which gave a completely different error:
A non-recoverable condition has triggered. Watchman needs your help!
The triggering condition was at timestamp=1407695600: inotify-add-watch(/my/path) -> Cannot allocate memory
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
The Facebook troubleshooting page for this is extremely vague and I couldn't resolve that error either.
I'm very new to this so I'd appreciate any help with this issue. Thank you for your time.
Update
Install watchman via linuxbrew.
When using linuxbrew remember to include the following commands before installing any formula:
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
brew update && brew upgrade
Then install the latest release of watchman:
brew install --HEAD watchman
Then increase the amount of inotify user instances, user watches and queued events:
echo fs.inotify.max_user_instances=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
echo fs.inotify.max_queued_events=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Now watchman should be working and react-native start should run fine!