eas-cli
eas-cli copied to clipboard
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?
This issue is stale because it has been open for 30 days with no activity. If there is no activity in the next 7 days, the issue will be closed.
Facing the same issue, did you fix it?
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?
I was wondering the same thing based on my stack trace.
@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.
Thanks for reporting this. I am working on setting up a monorepo so that we can reproduce this and fix the issue in EAS CLI.
Awesome, thanks @jonsamp. The solito starter monorepo might help: solito.dev/starter
I am attempting to make a reproduction of this issue so that we can get to the bottom of it. I made this repo: https://github.com/jonsamp/my-solito-app
That repo is a monorepo with an expo app + a github action. The only modified part of the github action from the template in the docs is this line to specify the working-directory
.
After running eas update
, I am seeing the CI action publish correctly and without the error mentioned. So! I think I'm missing a part of the issue.
If anyone can clone that repo and suggest what I might do to reproduce this issue, let me know. I'll continue investigating.
eas update --skip-bundle
How do you get the metadata.json ?
I'm also experiencing this issue. It's not a monorepo.
When I set EXPO_DEBUG=1
then I get JavaScript heap out of memory
.
Run eas update --branch demo --message "Testing"
- Linking to project @[owner]/[project]
✔ Linked to project @[owner]/[project] (https://expo.dev/accounts/[owner]/projects/[project])
- Building bundle...
[expo-cli] - Making sure project is set up correctly...
- Building bundle...
[expo-cli]
- Building bundle...
[expo-cli] [07:44:12] Export Assets:
- Building bundle...
[expo-cli] [07:44:12] - Asset target: managed
- Building bundle...
[expo-cli] Expo Metro config:
- Building bundle...
[expo-cli] - Bundler target: bare
- Building bundle...
[expo-cli] - Legacy: false
- Building bundle...
[expo-cli] - Extensions: ts, tsx, js, jsx, json
- Building bundle...
[expo-cli] - React Native: /home/runner/work/[github-project-name]/[github-project-name]/node_modules/react-native
- Building bundle...
[expo-cli] - Babel config: /home/runner/work/[github-project-name]/[github-project-name]/babel.config.js
- Building bundle...
[expo-cli] - Resolver Fields: react-native, browser, main
- Building bundle...
[expo-cli] - Exotic: false
- Building bundle...
[expo-cli]
- Building bundle...
[expo-cli] Expo Metro config:
- Building bundle...
[expo-cli] - Bundler target: bare
- Building bundle...
[expo-cli] - Legacy: false
- Building bundle...
[expo-cli] - Extensions: ts, tsx, js, jsx, json
- Building bundle...
[expo-cli] - React Native: /home/runner/work/[github-project-name]/[github-project-name]/node_modules/react-native
- Building bundle...
[expo-cli] - Babel config: /home/runner/work/[github-project-name]/[github-project-name]/babel.config.js
- Building bundle...
[expo-cli] - Resolver Fields: react-native, browser, main
- Building bundle...
[expo-cli] - Exotic: false
- Building bundle...
[expo-cli] [07:44:13] Starting Metro Bundler
- Building bundle...
[expo-cli] <--- Last few GCs --->
- Building bundle...
[expo-cli]
- Building bundle...
[expo-cli] [1893:0x4c749b0] 666395 ms: Mark-sweep 2003.2 (2081.4) -> 1987.6 (2082.4) MB, 3431.8 / 0.1 ms (average mu = 0.205, current mu = 0.159) allocation failure scavenge might not succeed
- Building bundle...
[expo-cli] [1893:0x4c749b0] 670280 ms: Mark-sweep 2004.4 (2083.2) -> 1989.1 (2084.4) MB, 3667.3 / 0.0 ms (average mu = 0.136, current mu = 0.056) allocation failure scavenge might not succeed
- Building bundle...
[expo-cli]
- Building bundle...
[expo-cli]
- Building bundle...
[expo-cli] <--- JS stacktrace --->
- Building bundle...
[expo-cli]
- Building bundle...
[expo-cli] FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
- Building bundle...
[expo-cli] 1: 0xb09980 node::Abort() [node]
- Building bundle...
[expo-cli] 2: 0xa1c235 node::FatalError(char const*, char const*) [node]
- Building bundle...
[expo-cli] 3: 0xcf784e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
- Building bundle...
[expo-cli] 4: 0xcf7bc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
- Building bundle...
[expo-cli] 5: 0xeaf465 [node]
- Building bundle...
[expo-cli] 6: 0xeaff46 [node]
- Building bundle...
[expo-cli] 7: 0xebe46e [node]
- Building bundle...
[expo-cli] 8: 0xebeeb0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
- Building bundle...
[expo-cli] 9: 0xec1e2e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
- Building bundle...
[expo-cli] 10: 0xe8336a v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
- Building bundle...
[expo-cli] 11: 0x11fc0b6 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
- Building bundle...
[expo-cli] 12: 0x15f0b19 [node]
- 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
When running on a Mac runner, it correctly identifies that the bundle didn't build:
eas update --branch demo --message "Testing 123"
shell: /bin/bash -e {0}
env:
EXPO_TOKEN: ***
- Linking to project @[owner]/[project]
✔ Linked to project @[owner]/[project] (https://expo.dev/accounts/[owner]/projects/[project])
- Building bundle...
✖ Failed to build bundle!
Error: /Users/runner/work/[github-project-name]/[github-project-name]/node_modules/e
xpo/bin/cli.js exited with non-zero code: 1
Error: Process completed with exit code 1.
@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.
Hi, just stumbled this issue with Github Actions. @jonsamp does that work for github actions?
@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
It worked 👍
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 🤷
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
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
It seems like there's a workaround for this issue, which is shown above. I am going to close this issue for now. Please reach out if you continue to see issues.
in app.json
this fails
...
"web": {
"bundler": "metro",
"output": "static",
"favicon": "./assets/favicon.png"
},
This works wit eas updtate
:
"web": {
"favicon": "./assets/favicon.png"
},
in
app.json
this fails... "web": { "bundler": "metro", "output": "static", "favicon": "./assets/favicon.png" },
This works wit
eas updtate
:"web": { "favicon": "./assets/favicon.png" },
can confirm this works, unfortunately though then local web development breaks.