【问题标题】:watchman: error while loading shared libraries: libpcre.so.1守望者:加载共享库时出错:libpcre.so.1
【发布时间】:2016-04-02 14:53:37
【问题描述】:

我在 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

现在 watchman 应该可以工作了,react-native start 应该可以正常运行了!

【问题讨论】:

    标签: android node.js facebook react-native watchman


    【解决方案1】:

    您发布的第一个问题是 ldconfig 相关问题;由于 pcre 二进制文件未安装在系统库路径中,因此您的运行时链接器无法在运行时解析它们,因此无法启动 watchman 二进制文件。

    我无法帮助您直接解决这部分问题,但听起来您尝试的后续步骤让您处于更好的位置。

    请注意,watchman 当前发布的版本是 4.5.0;你遵循的方向已经过时(你能告诉我你在哪里找到这些方向吗?) https://facebook.github.io/watchman/docs/install.html 始终拥有当前信息。

    现在,关于毒物问题:

    您看到的错误消息包括一个指向https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify_add_watch 的(损坏的,抱歉!)链接,其中对正在发生的事情进行了一些解释。

    您需要阅读有关正确设置系统限制的部分: https://facebook.github.io/watchman/docs/install.html#system-specific-preparation

    完成后,您可以通过运行watchman shutdown-server 清除状态

    这有帮助吗?我想了解您认为其中哪些部分含糊不清,以便我可以为其他人改进它!

    【讨论】:

    • 嗨@WezFurlong 我正在使用这个链接:facebook.github.io/react-native/docs/…。也许只包括我在我的问题下的 Update 部分中放置的那些命令。它清楚地显示了增加 inotify 的不同值所需的命令。对于像我这样的新手来说会好很多。再次感谢您的帮助!
    【解决方案2】:

    关于完全不同的错误

    你已经有 watchman 在运行,所以当你运行 react-native start 时,它会尝试启动另一个。

    1. 首次运行watchman shutdown-server
    2. 再次打开您的模拟器
    3. 在终端拨打react-native start
    4. 在模拟器中打开您的应用程序。

    一切都应该工作。它对我有用。

    【讨论】:

      猜你喜欢
      • 2021-04-08
      • 2020-05-23
      • 2011-05-29
      • 2013-10-27
      • 1970-01-01
      相关资源
      最近更新 更多