I’m trying to set up a pipeline in Gitlab to test and publish to Expo. Testing works fine; but the “expo publish” always fails in the iOS bundle build with this message:
[17:48:52] Unable to find an existing Expo CLI instance for this directory, starting a new one…
[17:48:54] Starting Metro Bundler on port 19001.
[17:48:55] Publishing to channel ‘default’…
[17:48:56] Building iOS bundle
[17:49:07] internal/fs/watchers.js:173
[17:49:07] throw error;
[17:49:07] ^
[17:49:07]
[17:49:07] Error: ENOSPC: System limit for number of file watchers reached…
My .gitlab-ci.yml file looks like this:
image: node:alpine
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .yarn
stages:
- test
- deploy
before_script:
- yarn config set cache-folder .yarn
- yarn install --frozen-lockfile
jest-tests:
stage: test
script:
- yarn run jest --ci
expo-deployments:
stage: deploy
script:
- apk add --no-cache bash
- yarn run expo login -u $EXPO_USERNAME -p $EXPO_PASSWORD
- yarn run expo publish --non-interactive
Is the sysctl.conf regenerated periodically in that environment? If not, it seems wrong to append that line to the file every time you build
If you want a once-off command to increase the limit for the duration of the “session”, you could run sysctl fs.inotify.max_user_watches=524288 instead of the above.
Alternatively, add fs.inotify.max_user_watches=524288 to /etc/sysctl.conf and don’t add it to your .gitlab-ci.yml.
See this comment for others you might want to set: