eas-cli: EAS Update - Github Action: JsonFileError: Can't read JSON file

Build/Submit details page URL

No response

Summary

We are on the production plan and are experimenting with eas-update for automating CI test JS bundle updates.

I’ve followed the steps listed here to setup a Github action (using npm instead of yarn) that automatically updates when our main iteration-2 github branch is pushed to with the following Github action:

name: EAS Iteration Update
on:
  workflow_dispatch:
  push:
    branches:
      - 'iteration**'
jobs:
  build:
    name: EAS Update
    runs-on: ubuntu-latest
    steps:
      - name: Check for EXPO_TOKEN
        run: |
          if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
            echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
            exit 1
          fi
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: 16.x
          cache: npm
      - uses: expo/expo-github-action@v7
        with:
          expo-version: latest
          eas-version: latest
          token: ${{ secrets.EXPO_TOKEN }}
      - name: Install dependencies
        run: npm install
      - name: Publish update
        run: eas update --auto

However, this is currently failing with the following error:

- Linking to project @[owner]/[project]
✔ Linked to project @[owner]/[project] (​[https://expo.dev/accounts/[owner]/projects/[project]​)](https://expo.dev/accounts/[owner]/projects/[project]))
- Building bundle...
✔ Built bundle!
- Uploading assets...
✖ Failed to upload assets
    JsonFileError: Can't read JSON file: 
    /home/runner/work/[github-project-name]/[github-project-name]/dist/metadata.json
    ├─ File: /home/runner/work/[github-project-name]/[github-project-name]/dist/metadata.json
    └─ Cause: Error: ENOENT: no such file or directory, open 
    '/home/runner/work/[github-project-name]/[github-project-name]/dist/metadata.json'
    Code: ENOENT
Error: Process completed with exit code 1.

Is this something we’re doing wrong? I wasn’t sure why the path would have 2 instances of the github project name but maybe that’s a red herring?

Thanks for your help!

Managed or bare?

Managed

Environment

System: OS: macOS 12.1 Shell: 5.8 - /bin/zsh Binaries: Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node Yarn: 1.22.5 - ~/.yarn/bin/yarn npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/lib/ruby/gems/3.0.0/bin/pod SDKs: iOS SDK: Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0 IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7784292 Xcode: 13.0/13A233 - /usr/bin/xcodebuild npmPackages: expo: ~44.0.0 => 44.0.6 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 npmGlobalPackages: eas-cli: 0.47.0 expo-cli: 5.2.0 Expo Workflow: managed

Error output

JsonFileError: Can’t read JSON file: /home/runner/work/[github-project-name]/[github-project-name]/dist/metadata.json ├─ File: /home/runner/work/[github-project-name]/[github-project-name]/dist/metadata.json └─ Cause: Error: ENOENT: no such file or directory, open ‘/home/runner/work/[github-project-name]/[github-project-name]/dist/metadata.json’

Reproducible demo or steps to reproduce from a blank project

Happy to share anything else required to track down the cause?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 19 (4 by maintainers)

Most upvoted comments

@teovillanueva Yes, it did work for me. You can set it like this :

- run: 'eas update --branch demo --message "Testing"'
  env:
    NODE_OPTIONS: "--max-old-space-size=8192"
    EXPO_DEBUG: 1

Posting here in case someone is facing the same problem. We rely on CircleCI to run the eas update. We had the same problem of out of memory error. We tried the above mentioned fixes, with no luck.

We changed the metro config to limit the number of workers to 2. And it fixed the thing.

Actually, metro roughly defaults to os.cpu() / 2 for maxWorkers. So in a 8 cores CircleCI instance it would be maxWorkers === 4. Unfortunately it is too much and causes memory issues.

Setting maxWorkers: 2 in the metro config solved our issue. Metro maxWorkers doc: https://facebook.github.io/metro/docs/configuration/#maxworkers

Hope this helps 🤷

Hi guys, I’ve encountered this issue as well, I’m using solito monorepo.

got this output below, it seems the folder name repeated, any ideas how to fix this?

[expo-cli] - React Native: /home/runner/work/www-monorepo/www-monorepo/apps/patients-expo/node_modules/react-native
- Exporting...
[expo-cli] - Babel config: /home/runner/work/www-monorepo/www-monorepo/apps/patients-expo/babel.config.js
- Exporting...
[expo-cli] - Resolver Fields: react-native, browser, main
- Exporting...
[expo-cli] - Watch Folders: /home/runner/work/www-monorepo/www-monorepo/node_modules, /home/runner/work/www-monorepo/www-monorepo/apps/patients-expo, /home/runner/work/www-monorepo/www-monorepo/apps/patients-next, /home/runner/work/www-monorepo/www-monorepo/packages/app
- Exporting...
[expo-cli] - Node Module Paths: /home/runner/work/www-monorepo/www-monorepo/apps/patients-expo, /home/runner/work/www-monorepo/www-monorepo/node_modules

Edit: Oh sorry, just got it working by adding this 🎉

@teovillanueva Yes, it did work for me. You can set it like this :

- run: 'eas update --branch demo --message "Testing"'
  env:
    NODE_OPTIONS: "--max-old-space-size=8192"
    EXPO_DEBUG: 1

Based on comment above, I changed maxWorkers to 2 in Expo Metro config and it worked.

// metro.config.js
const { getDefaultConfig } = require('expo/metro-config')

const config = getDefaultConfig(__dirname)
config.maxWorkers = 2

module.exports = config

@GregAtFramework A workaround is to add a NODE_OPTIONS=--max_old_space_size=4096 env var before running the EAS CLI command.

We are still trying to find a good reproduction example so that we can fix this issue, if you have or know of one.

Awesome, thanks @jonsamp. The solito starter monorepo might help: solito.dev/starter

@nickkuh are you using a monorepo by chance? I’m having this problem in my monorepo. I think the 2 instances of github project name may be due to expo improperly resolving the source of the project when it is a monorepo package.