`eas env:pull` fails if not existing `.env` file
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 236
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 98
Description
### Build/Submit details page URL
_No response_
### Summary
On a project where we're moving into using Expo's environment variables, when using the `eas env:pull` command, I'm seeing this error:
```
Failed to read the app config from the project using "npx expo config" command: npx expo config --json exited with non-zero code: 1.
Falling back to the version of "@expo/config" shipped with the EAS CLI.
Branch API key is required: expo.android.config.branch.apiKey
Error: env:pull command failed.
```
The error is not specific to `expo.android.config.branch.apiKey` since if I hardcode a value on the `app.config.ts` for that configuration value, then we get an error in regards to other env.
The log specifically says:
```
npx expo config --json exited with non-zero code: 1
```
But when I run `npx expo config --json` myself, I don't see any error and I get printed out a valid configuration in json format where I can specifically see `expo.android.config.branch.apiKey` and all of the other environment variables I try to access on the `app.config.ts` file.
Has anybody faced a similar issue? Any hints?
For more context, running `expo prebuild` `app.config.ts` is correctly setting up all the plugins correctly and reading `process.env.EXPO_PUBLIC_*` env's correctly, issue is only happening with `eas env:pull` for some reason.
### Managed or bare?
Moving into Managed
### Environment
```
expo-env-info 1.3.3 environment info:
System:
OS: macOS 14.6.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.15.0 - ~/.nvm/versions/node/v22.15.0/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v22.15.0/bin/yarn
npm: 10.9.2 - ~/.nvm/versions/node/v22.15.0/bin/npm
Watchman: 2025.04.28.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.16.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 24.2, iOS 18.2, macOS 15.2, tvOS 18.2, visionOS 2.2, watchOS 11.2
IDEs:
Android Studio: 2024.1 AI-241.18034.62.2411.12169540
Xcode: 16.2/16C5032a - /usr/bin/xcodebuild
npmPackages:
expo: ^52.0.46 => 52.0.46
expo-updates: ~0.27.1 => 0.27.4
react: 18.3.1 => 18.3.1
react-native: 0.76.9 => 0.76.9
npmGlobalPackages:
eas-cli: 16.6.2
Expo Workflow: bare
```
### Error output
```
✔ Select environment: › development
Failed to read the app config from the project using "npx expo config" command: npx expo config --json exited with non-zero code: 1.
Falling back to the version of "@expo/config" shipped with the EAS CLI.
Branch API key is required: expo.android.config.branch.apiKey
Error: Branch API key is required: expo.android.config.branch.apiKey
at withBranchAndroid (/Users/danielgonzalez/Code/Joe/re-clone/new/joe-pay-app/node_modules/@config-plugins/react-native-branch/build/withBranchAndroid.js:27:15)
at withBranch (/Users/danielgonzalez/Code/Joe/re-clone/new/joe-pay-app/node_modules/@config-plugins/react-native-branch/build/withBranch.js:7:56)
at plugin (/Users/danielgonzalez/Code/Joe/re-clone/new/joe-pay-app/node_modules/@expo/config-plugins/build/plugins/withRunOnce.js:49:25)
at withRunOnce (/Users/danielgonzalez/Code/Joe/re-clone/new/joe-pay-app/node_modules/@expo/config-plugins/build/plugins/withRunOnce.js:37:10)
at /Users/danielgonzalez/Code/Joe/re-clone/new/joe-pay-app/node_modules/@expo/config-plugins/build/plugins/withRunOnce.js:48:12
at withStaticPlugin (/Users/danielgonzalez/.nvm/versions/node/v22.15.0/lib/node_modules/eas-cli/node_modules/@expo/config-plugins/build/plugins/withStaticPlugin.js:146:12)
at /Users/danielgonzalez/.nvm/versions/node/v22.15.0/lib/node_modules/eas-cli/node_modules/@expo/config-plugins/build/plugins/withPlugins.js:30:84
at Array.reduce ()
at withPlugins (/Users/danielgonzalez/.nvm/versions/node/v22.15.0/lib/node_modules/eas-cli/node_modules/@expo/config-plugins/build/plugins/withPlugins.js:30:18)
at withConfigPlugins (/Users/danielgonzalez/.nvm/versions/node/v22.15.0/lib/node_modules/eas-cli/node_modules/@expo/config/build/plugins/withConfigPlugins.js:35:47)
Error: env:pull command failed.
```
### Reproducible demo or steps to reproduce from a blank project
Will potentialy do.
Contributor guide
Assessment
This issue has not been assessed yet.