Skip to content

EAS Build --local does not respect .npmrc or noproxy when fetching Expo template - leads to failed prebuild in proxied environments #3144

@Veinar

Description

@Veinar

Build/Submit details page URL

No response

Summary

Hi Expo Team,

We're encountering a problem with eas build --local where the prebuild step fails to fetch the Expo template from our private Artifactory registry due to proxy misconfiguration — even though we've correctly configured .npmrc, environment variables, and certificates.

We are not trying to skip prebuild, but we need to override the default proxy behavior for .tgz downloads (specifically the Expo template) to avoid routing them through our corporate proxy.


Our network setup:

  • We are behind a corporate proxy
  • Internal NPM packages (including expo-template-bare-minimum) are served via private Artifactory
Proxy: http://10.17.255.21:80
Artifactory NPM proxy: https://artifactory-nginx-jfrog.apps.cluster.local

The local build command:

We run:

NODE_EXTRA_CA_CERTS="/tmp/ca/artifactory-ca.crt" \
http_proxy="http://10.17.255.21:80" \
https_proxy="http://10.17.255.21:80" \
NODE_TLS_REJECT_UNAUTHORIZED=0 \
no_proxy="localhost,127.0.0.1,.cluster.local,artifactory-nginx-jfrog.apps.cluster.local" \
NO_PROXY="localhost,127.0.0.1,.cluster.local,artifactory-nginx-jfrog.apps.cluster.local" \
EXPO_TOKEN="..." \
eas build --local --platform android --profile development --output app.apk

But it crashes during prebuild (exact problem is later on that gradle stuff is missing but this is root cause):

[PREBUILD] Fetch from URL: https://artifactory-nginx-jfrog.../expo-template-bare-minimum-53.0.38.tgz
[PREBUILD] expo:api:fetch:proxy Using proxy: http://10.17.255.21:80
[PREBUILD] Props Authentication Token not found
✖ Failed to create the native directory

This fetch should not use the proxy, and Artifactory requires no proxy and a trusted internal certificate.


✅ What works: manual expo prebuild

To workaround this, we created a bootstrap.js file to override proxy-from-env and bypass proxy usage for .tgz template downloads:

const { getGlobalDispatcher, setGlobalDispatcher, ProxyAgent } = require('undici');
const originalGetProxyForUrl = require('proxy-from-env').getProxyForUrl;

require('proxy-from-env').getProxyForUrl = function (url) {
  if (url.includes('expo-template-bare-minimum') && url.endsWith('.tgz')) {
    console.log('Skipping proxy for Expo template .tgz:', url);
    return '';
  }
  return originalGetProxyForUrl(url);
};

const proxy = process.env.https_proxy || process.env.http_proxy;
if (proxy) {
  console.log('Proxy active globally:', proxy);
  setGlobalDispatcher(new ProxyAgent(proxy));
}

We then ran:

NODE_OPTIONS="-r ./bootstrap.js" expo prebuild

✅ This successfully runs expo prebuild and downloads the template via Artifactory without proxy.


What fails: eas build --local

We tried using the same workaround for eas build by prepending:

NODE_OPTIONS="-r /exact/path/to/bootstrap.js"

(We passed the full absolute path to ensure it’s found.)

But the bootstrap.js does not get loaded — likely because eas build --local runs in a temporary directory and does not preserve context from the original working directory.

We also tried setting EAS_LOCAL_BUILD_SKIP_COPY=true, but this was ignored.


What we need

We’d like eas build --local to respect:

  • NODE_OPTIONS=-r ./bootstrap.js consistently across all phases, especially inside the internal expo prebuild call
  • OR provide a documented, supported way to inject proxy override logic for such cases

Let us know if there’s any workaround or proper hook to achieve this — we’re happy to test suggestions!

Thanks 🙏
Konrad

Managed or bare?

Managed

Environment

n/a

Error output

[PREBUILD] Fetch from URL: https://artifactory-nginx-jfrog.../expo-template-bare-minimum-53.0.38.tgz
[PREBUILD] expo:api:fetch:proxy Using proxy: http://10.17.255.21:80
[PREBUILD] Props Authentication Token not found
✖ Failed to create the native directory

Reproducible demo or steps to reproduce from a blank project

Just use proxy for http/https and have artifactory on internal web that does cannot be proxied and you may even use our example env that we set up before executing build command

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs reviewIssue is ready to be reviewed by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions