GuidesExpo Application ServicesAPI Reference
ArchiveExpo SnackDiscordForumsChangelog

Using npm cache with Yarn Classic

Learn how to use npm cache by overriding the registry in Yarn Classic.

By default, the EAS npm cache won't work with Yarn 1 (Classic), because yarn.lock files contain URLs to registries for every package and Yarn does not provide any way to override it. The issue is fixed in Yarn 2+ (Berry), but the Yarn team does not plan to backport it to Yarn v1.

If you want to take advantage of the npm cache, you can add the eas-build-pre-install npm hook in package.json to override the registry in the yarn.lock:

  "scripts": {
    "eas-build-pre-install": "bash -c \"[ ! -z \\\"$EAS_BUILD_NPM_CACHE_URL\\\" ] && sed -i -e \\\"s#$EAS_BUILD_NPM_CACHE_URL#g\\\" yarn.lock\" || true"