首页 > 解决方案 > 在 docker 中找不到 Watchman,但 react-native 成功构建了包

问题描述

我正在使用reactnativecommunity/react-native-android docker图像在 gitlab-ci 中构建一个 react-native android 应用程序。如果我理解正确,react-native 需要watchman构建捆绑包。

但我注意到它watchman没有安装在 docker 映像上,我也没有将它安装在.gitlab-ci.yml. 此外,当我添加which watchmanorwatchman watch-del-all.gitlab-ci.yml,它返回watchman: command not found.

但是 react-native 是如何构建捆绑包的呢?

标签: androiddockerreact-nativegitlab

解决方案


在 yml 脚本中,您必须安装 watchman。以下是相同的步骤

  - apt-get --quiet install --yes autoconf automake build-essential
  - apt-get --quiet install --yes python-dev libtool pkg-config libssl-dev
  - git clone https://github.com/facebook/watchman.git
  - cd watchman
  - git checkout v4.9.0
  - ./autogen.sh
  - ./configure --enable-lenient
  - make
  - make install
  - cd ..
  - watchman --version

推荐阅读