我在 Ubuntu 15.10 上,我正在使用 react-native (0.20.0) 开发一个 Android (SDK 23) 应用程序。我正在使用节点 5.6.0 和 npm 3.6.0。
运行时遇到守望者错误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)
当我运行时sudo find / -name libpcre.so.1
返回以下内容:
/home/rachael/.linuxbrew/lib/libpcre.so.1
/home/rachael/.linuxbrew/Cellar/pcre/8.38/lib/libpcre.so.1
我试过重新安装守望者:
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
我也用 linuxbrew 试过:
npm r -g watchman
brew update && brew upgrade
brew install watchman
这给出了一个完全不同的错误:
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
Facebook 的故障排除页面非常模糊,我也无法解决该错误。
我对此很陌生,因此我将不胜感激有关此问题的任何帮助。感谢您的时间。
更新
通过 linuxbrew 安装 watchman。
使用 linuxbrew 时,请记住在安装任何公式之前包含以下命令:
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
brew update && brew upgrade
然后安装最新版本的watchman:
brew install --HEAD watchman
然后增加 inotify 用户实例、用户监视和排队事件的数量:
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
现在守望者应该工作并且react-native start
应该运行良好!