r.oregan r.oregan - 1 year ago 170
Android Question

watchman: error while loading shared libraries: libpcre.so.1

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:


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 .
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

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.


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!

Answer Source

The first problem that you posted is a ldconfig related problem; since the pcre binaries are not installed in the system library path, your runtime linker cannot resolve them at runtime and thus cannot start the watchman binary.

I cannot help you directly resolve that part of the problem, but it sounds like the later steps you tried put you in a better position.

Please note that the current released version of watchman is 4.5.0; the directions you were following are outdated (Could you tell me where you found those directions?) https://facebook.github.io/watchman/docs/install.html always has the current information.

Now, to the poison issue:

The error message you saw included a (broken, sorry!) link to https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify_add_watch that has some explanation about what is happening.

You need to read this section on setting up your system limits correctly: https://facebook.github.io/watchman/docs/install.html#system-specific-preparation

and once done, you can clear the state by running watchman shutdown-server

Did that help? I'd like to understand which parts of this you found vague so that I can improve it for others!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download