rn node 版本问题
报错信息:Command PhaseScriptExecution failed with a nonzero exit code
Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:79:19) at Object.createHash (node:crypto:139:10) at stableHash (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro-cache/src/stableHash.js:19:8) at Object.getCacheKey (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro-transform-worker/src/index.js:593:7) at getTransformCacheKey (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/DeltaBundler/getTransformCacheKey.js:24:19) at new Transformer (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/DeltaBundler/Transformer.js:48:9) at /Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/Bundler.js:22:29 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error', 'error:0308010C:digital envelope routines::unsupported' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' } error Cannot read properties of undefined (reading 'transformFile'). TypeError: Cannot read properties of undefined (reading 'transformFile') at Bundler.transformFile (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/Bundler.js:48:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.transform (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/lib/transformHelpers.js:101:12) at async processModule (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:18) at async traverseDependenciesForSingleFile (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:131:3) at async Promise.all (index 0) at async initialTraverseDependencies (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/DeltaBundler/traverseDependencies.js:114:3) at async DeltaCalculator._getChangedDependencies (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:164:25) at async DeltaCalculator.getDelta (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:94:16) at async DeltaBundler.buildGraph (/Users/zhengyan/works/app/sinochem-ubmp-app/node_modules/metro/src/DeltaBundler.js:50:5) info Run CLI with --verbose flag for more details.
由于node版本升级引起的打包报错
解决办法:
打开xcode 找到 Build Phases => Bundle react native code and images 添加 export NODE_OPTIONS=--openssl-legacy-provider