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

Sun May 29 2022
  • React Native
  • Expo
  • TIL

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

idb/build/index.cjs is not computed.


1> Task :app:generatePackageList 2> Task :app:preBuild 3> Task :app:preReleaseBuild 4> Task :app:bundleReleaseJsAndAssets 5[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 6[stderr] ? android: block-permissions: No permissions provided 7warning: the transform cache was reset. 8 Welcome to Metro! 9 Fast - Scalable - Integrated 10[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. 11[stderr] Potential causes: 12[stderr] 1) You have symlinks in your project - watchman does not follow symlinks. 13[stderr] 2) Check `blockList` in your metro.config.js and make sure it isn't excluding the file path. 14ReferenceError: 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. 15 Potential causes: 16 1) You have symlinks in your project - watchman does not follow symlinks. 17 2) Check `blockList` in your metro.config.js and make sure it isn't excluding the file path. 18 at DependencyGraph.getSha1 (/home/expo/workingdir/build/apps/app/node_modules/metro/src/node-haste/DependencyGraph.js:191:13) 19 at Transformer.transformFile (/home/expo/workingdir/build/apps/app/node_modules/metro/src/DeltaBundler/Transformer.js:104:23) 20 at Bundler.transformFile (/home/expo/workingdir/build/apps/app/node_modules/metro/src/Bundler.js:57:30) 21 at async Object.transform (/home/expo/workingdir/build/apps/app/node_modules/metro/src/lib/transformHelpers.js:101:12) 22 at async processModule (/home/expo/workingdir/build/apps/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:18) 23 at async addDependency (/home/expo/workingdir/build/apps/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18) 24 at async Promise.all (index 10) 25 at async processModule (/home/expo/workingdir/build/apps/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:198:5) 26 at async addDependency (/home/expo/workingdir/build/apps/app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18) 27 at async Promise.all (index 0) 28info Run CLI with --verbose flag for more details. 29> Task :app:bundleReleaseJsAndAssets FAILED 30[stderr] FAILURE: Build failed with an exception. 31[stderr] * What went wrong: 32[stderr] Execution failed for task ':app:bundleReleaseJsAndAssets'. 33[stderr] > Process 'command 'node'' finished with non-zero exit value 1 34[stderr] * Try: 35[stderr] > Run with --stacktrace option to get the stack trace. 36[stderr] > Run with --info or --debug option to get more log output. 37[stderr] > Run with --scan to get full insights. 38[stderr] * Get more help at 39[stderr] BUILD FAILED in 5m 15s

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




1const { withNxMetro } = require('@nrwl/expo'); 2const { getDefaultConfig } = require('@expo/metro-config'); 3 4const defaultConfig = getDefaultConfig(__dirname); 5 6module.exports = (async () => { 7 defaultConfig.transformer.babelTransformerPath = require.resolve( 8 'react-native-svg-transformer' 9 ); 10 defaultConfig.resolver.assetExts = defaultConfig.resolver.assetExts.filter( 11 (ext) => ext !== 'svg' 12 ); 13 defaultConfig.resolver.sourceExts.push('svg'); 14 defaultConfig.resolver.assetExts.push("cjs"); 15 return withNxMetro(defaultConfig, { 16 // Change this to true to see debugging info. 17 // Useful if you have issues resolving modules 18 debug: false, 19 // all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx' 20 extensions: [], 21 // the project root to start the metro server 22 projectRoot: __dirname, 23 // Specify any additional (to projectRoot) watch folders, this is used to know which files to watch 24 watchFolders: [] 25 }); 26})();

Invalid bitcode version


1 2❌ ld: could not reparse object file in bitcode bundle: 'Invalid bitcode version (Producer: '1316.' Reader: '1300.0.29.3_0')', using libLTO version 'LLVM version 13.0.0, (clang-1300.0.29.3)' for architecture arm64 3 4❌ clang: error: linker command failed with exit code 1 (use -v to see invocation) 5 6▸ ** ARCHIVE FAILED ** 7▸ The following build commands failed: 8▸ Ld /Users/expo/Library/Developer/Xcode/DerivedData/GOFOOD-bzcbywoupmkkdtcxarofoooxnnmm/Build/Intermediates.noindex/ArchiveIntermediates/GOFOOD/InstallationBuildProductsLocation/Applications/ normal (in target 'GOFOOD' from project 'GOFOOD') 9▸ (1 failure) 10** ARCHIVE FAILED ** 11The following build commands failed: 12 Ld /Users/expo/Library/Developer/Xcode/DerivedData/GOFOOD-bzcbywoupmkkdtcxarofoooxnnmm/Build/Intermediates.noindex/ArchiveIntermediates/GOFOOD/InstallationBuildProductsLocation/Applications/ normal (in target 'GOFOOD' from project 'GOFOOD') 13(1 failure) 14Exit status: 65 15+-------------+-------------------------+ 16| Build environment | 17+-------------+-------------------------+ 18| xcode_path | /Applications/ | 19| gym_version | 2.185.1 | 20| sdk | iPhoneOS15.0.sdk | 21+-------------+-------------------------+ 22Looks like fastlane ran into a build/archive error with your project 23It's hard to tell what's causing the error, so we wrote some guides on how 24to troubleshoot build and signing issues: 25Before submitting an issue on GitHub, please follow the guide above and make 26sure your project is set up correctly. 27fastlane uses `xcodebuild` commands to generate your binary, you can see the 28the full commands printed out in yellow in the above log. 29Make sure to inspect the output above, as usually you'll find more error information there 30[stderr] [!] Error building the application - see the log above 31Error: Fastlane build failed with unknown error. Please refer to the "Run fastlane" and "Xcode Logs" phases. 32Fastlane 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.



1 "ios": { 2 "image": "latest" 3 },