blog.unresolved.xyz
Sun May 29 2022

@nrwl/expoでeas buildしようとしてクソほど躓いたので供養する

最近Nx + NestJS + React Nativeで開発してて、Classic BuildからEAS Buildに移行しようとしたらすごい躓いたので書いておきたい。

idb/build/index.cjs is not computed.

1個めはこれ。

> Task :app:generatePackageList
> Task :app:preBuild
> Task :app:preReleaseBuild
> Task :app:bundleReleaseJsAndAssets
[stderr] warn Package firebase-admin has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /home/expo/workingdir/build/apps/app/node_modules/firebase-admin/package.json
[stderr] ? android: block-permissions: No permissions provided
warning: the transform cache was reset.
                    Welcome to Metro!
              Fast - Scalable - Integrated
[stderr] error SHA-1 for file /home/expo/workingdir/build/apps/app/node_modules/idb/build/index.cjs (/home/expo/workingdir/build/apps/app/node_modules/idb/build/index.cjs) is not computed.
[stderr]          Potential causes:
[stderr]            1) You have symlinks in your project - watchman does not follow symlinks.
[stderr]            2) Check `blockList` in your metro.config.js and make sure it isn't excluding the file path.
ReferenceError: SHA-1 for file /home/expo/workingdir/build/apps/app/node_modules/idb/build/index.cjs (/home/expo/workingdir/build/apps/app/node_modules/idb/build/index.cjs) is not computed.
         Potential causes:
           1) You have symlinks in your project - watchman does not follow symlinks.
           2) Check `blockList` in your metro.config.js and make sure it isn't excluding the file path.
    at DependencyGraph.getSha1 (/home/expo/workingdir/build/apps/app/node_modules/metro/src/node-haste/DependencyGraph.js:191:13)
    at Transformer.transformFile (/home/expo/workingdir/build/apps/app/node_modules/metro/src/DeltaBundler/Transformer.js:104:23)
    at Bundler.transformFile (/home/expo/workingdir/build/apps/app/node_modules/metro/src/Bundler.js:57:30)
    at async Object.transform (/home/expo/workingdir/build/apps/app/node_modules/metro/src/lib/transformHelpers.js:101:12)
    at async processModule (/home/expo/workingdir/build/apps/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:18)
    at async addDependency (/home/expo/workingdir/build/apps/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18)
    at async Promise.all (index 10)
    at async processModule (/home/expo/workingdir/build/apps/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:198:5)
    at async addDependency (/home/expo/workingdir/build/apps/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18)
    at async Promise.all (index 0)
info Run CLI with --verbose flag for more details.
> Task :app:bundleReleaseJsAndAssets FAILED
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:bundleReleaseJsAndAssets'.
[stderr] > Process 'command 'node'' finished with non-zero exit value 1
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 5m 15s

metroがデフォだと .cjs を読めないので、 metro.config.js

defaultConfig.resolver.assetExts.push("cjs");

を追記すればいい。

全体は多分こんな感じになる。

const { withNxMetro } = require('@nrwl/expo');
const { getDefaultConfig } = require('@expo/metro-config');

const defaultConfig = getDefaultConfig(__dirname);

module.exports = (async () => {
  defaultConfig.transformer.babelTransformerPath = require.resolve(
    'react-native-svg-transformer'
  );
  defaultConfig.resolver.assetExts = defaultConfig.resolver.assetExts.filter(
    (ext) => ext !== 'svg'
  );
  defaultConfig.resolver.sourceExts.push('svg');
  defaultConfig.resolver.assetExts.push("cjs");
  return withNxMetro(defaultConfig, {
    // Change this to true to see debugging info.
    // Useful if you have issues resolving modules
    debug: false,
    // all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx'
    extensions: [],
    // the project root to start the metro server
    projectRoot: __dirname,
    // Specify any additional (to projectRoot) watch folders, this is used to know which files to watch
    watchFolders: []
  });
})();
  • https://bytemeta.vip/repo/firebase/firebase-js-sdk/issues/6253
    • リンク見れなくなった・・・?

Invalid bitcode version

2個めがこれ。


❌  ld: could not reparse object file in bitcode bundle: 'Invalid bitcode version (Producer: '1316.0.21.2.3_0' Reader: '1300.0.29.3_0')', using libLTO version 'LLVM version 13.0.0, (clang-1300.0.29.3)' for architecture arm64

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ 	Ld /Users/expo/Library/Developer/Xcode/DerivedData/GOFOOD-bzcbywoupmkkdtcxarofoooxnnmm/Build/Intermediates.noindex/ArchiveIntermediates/GOFOOD/InstallationBuildProductsLocation/Applications/GOFOOD.app/GOFOOD normal (in target 'GOFOOD' from project 'GOFOOD')
▸ (1 failure)
** ARCHIVE FAILED **
The following build commands failed:
	Ld /Users/expo/Library/Developer/Xcode/DerivedData/GOFOOD-bzcbywoupmkkdtcxarofoooxnnmm/Build/Intermediates.noindex/ArchiveIntermediates/GOFOOD/InstallationBuildProductsLocation/Applications/GOFOOD.app/GOFOOD normal (in target 'GOFOOD' from project 'GOFOOD')
(1 failure)
Exit status: 65
+-------------+-------------------------+
|           Build environment           |
+-------------+-------------------------+
| xcode_path  | /Applications/Xcode.app |
| gym_version | 2.185.1                 |
| sdk         | iPhoneOS15.0.sdk        |
+-------------+-------------------------+
Looks like fastlane ran into a build/archive error with your project
It's hard to tell what's causing the error, so we wrote some guides on how
to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
Before submitting an issue on GitHub, please follow the guide above and make
sure your project is set up correctly.
fastlane uses `xcodebuild` commands to generate your binary, you can see the
the full commands printed out in yellow in the above log.
Make sure to inspect the output above, as usually you'll find more error information there
[stderr] [!] Error building the application - see the log above
Error: Fastlane build failed with unknown error. Please refer to the "Run fastlane" and "Xcode Logs" phases.
Fastlane errors in most cases are not printed at the end of the output, so you may not find any useful information in the last lines of output when looking for an error message.

これはXCodeのバージョンに差異があると発生する。

eas.json

      "ios": {
        "image": "latest"
      },

とかやれば通る

  • https://github.com/expo/eas-cli/issues/1079
Author
Daisuke Tsuji

Daisuke Tsuji

フリーのSoftware Developer。

TypeScriptを触ってる時間が多い。コーディングもマークアップもライティングもデザインもSEOもやるタイプ。

だいたいどれもだめ。業務委託のお仕事募集中。