在纱线安装期间构建排毒失败
Posted
技术标签:
【中文标题】在纱线安装期间构建排毒失败【英文标题】:building Detox failed during yarn install 【发布时间】:2020-05-06 23:01:23 【问题描述】:当我执行 yarn install 时,我收到了这个错误:
[12/31] ⠈ detox
error /Users/mluu/Developer/mobile2/node_modules/detox: Command failed.
Exit code: 1
Command: node scripts/postinstall.js
Arguments:
Directory: /Users/mluu/Developer/mobile2/node_modules/detox
Output:
/Users/mluu/Library/Detox/ios/10dbe0f0b761264d99edb06a7f9b999416aad111 was found, but could not find Detox.framework inside it. This means that the Detox framework build process was interrupted.
deleting /Users/mluu/Library/Detox/ios/10dbe0f0b761264d99edb06a7f9b999416aad111 and trying to rebuild.
Extracting Detox sources...
Building Detox.framework from /Users/mluu/Developer/mobile2/node_modules/detox/ios_src...
child_process.js:637
throw err;
^
Error: Command failed: /Users/mluu/Developer/mobile2/node_modules/detox/scripts/build_framework.ios.sh
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at Object.<anonymous> (/Users/mluu/Developer/mobile2/node_modules/detox/scripts/postinstall.js:2:27)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
为什么我的排毒无法构建?我尝试按照建议删除我的 detox 文件夹,但仍然无法构建。
进入 /Users/mluu/Library/Detox/ios/10dbe0f0b761264d99edb06a7f9b999416aad111/detox_ios.log 发现:
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
cd /Users/mluu/Developer/mobile2/node_modules/detox/ios_src
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/mluu/.rvm/gems/ruby-2.6.3/bin:/Users/mluu/.rvm/gems/ruby-2.6.3@global/bin:/Users/mluu/.rvm/rubies/ruby-2.6.3/bin:/Users/mluu/.rvm/bin:/Users/mluu/.nvm/versions/node/v10.15.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/mluu/Library/android/sdk/tools:/Users/mluu/Library/Android/sdk/tools/bin:/Users/mluu/Library/Android/sdk/platform-tools:/Users/mluu/Library/Android/sdk/emulator"
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk
export TOOLCHAINS=com.apple.dt.toolchain.XcodeDefault
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name Detox -O -whole-module-optimization -enforce-exclusivity=checked @/Users/mluu/Library/Developer/Xcode/DerivedData/swoop-bjgdbvjbcvywzdbnzaexyenmqpew/Build/Intermediates.noindex/React.build/BetaDebug-iphoneos/React.build/Objects-normal/arm64/React.SwiftFileList -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -target arm64-apple-ios11.3 -g -module-cache-path /Users/mluu/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -profile-coverage-mapping -profile-generate -swift-version 4.2 -I /Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Products/Release-iphoneos -I /Users/mluu/Developer/mobile2/node_modules/detox/ios_src/Detox -F /Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Products/Release-iphoneos -c -num-threads 16 /Users/mluu/Developer/mobile2/node_modules/detox/ios_src/Detox/DetoxUserActivityDispatcher.swift /Users/mluu/Developer/mobile2/node_modules/detox/ios_src/Detox/DetoxUserNotificationDispatcher.swift -output-file-map /Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/Objects-normal/arm64/Detox-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/Objects-normal/arm64/Detox.swiftmodule -Xcc -I/Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/Detox-generated-files.hmap -Xcc -I/Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/Detox-own-target-headers.hmap -Xcc -I/Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/Detox-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/Detox-project-headers.hmap -Xcc -I/Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Products/Release-iphoneos/include -Xcc -IEarlGrey/fishhook -Xcc -I/Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/DerivedSources-normal/arm64 -Xcc -I/Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/DerivedSources/arm64 -Xcc -I/Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/DerivedSources -emit-objc-header -emit-objc-header-path /Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/Objects-normal/arm64/Detox-Swift.h -import-underlying-module -Xcc -ivfsoverlay -Xcc /Users/mluu/Library/Developer/Xcode/DerivedData/Detox-bpzzkihbqsknjafrnjvkjdiarlnq/Build/Intermediates.noindex/Detox.build/Release-iphoneos/Detox.build/unextended-module-overlay.yaml -working-directory /Users/mluu/Developer/mobile2/node_modules/detox/ios_src
<unknown>:0: error: no such file or directory: '/Users/mluu/Developer/mobile2/node_modules/detox/ios_src/@/Users/mluu/Library/Developer/Xcode/DerivedData/swoop-bjgdbvjbcvywzdbnzaexyenmqpew/Build/Intermediates.noindex/React.build/BetaDebug-iphoneos/React.build/Objects-normal/arm64/React.SwiftFileList'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
** BUILD FAILED **
The following build commands failed:
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(1 failure)
为什么要寻找 arm64/React.SwiftFileList?我如何生成这个?我尝试进入 xcode 并在实际的 iphone 7 上运行我的应用程序以使其生成 arm64 版本,但是当我回头查看该文件夹时没有生成任何内容。肯定有什么问题?
【问题讨论】:
您的环境中的某些东西似乎损坏了。在构建 Detox 时,其中不应该有任何 React,但在您的情况下,它正在寻找/Users/mluu/Developer/mobile2/node_modules/detox/ios_src/@/Users/mluu/Library/Developer/Xcode/DerivedData/swoop-bjgdbvjbcvywzdbnzaexyenmqpew/Build/Intermediates.noindex/React.build/BetaDebug-iphoneos/React.build/Objects-normal/arm64/React.SwiftFileList
【参考方案1】:
方法一:要让npm i
成功,如果npm片刻不需要detox就禁用detox,
要禁用排毒,请在项目终端 export DETOX_DISABLE_POSTINSTALL=1
上运行此命令,然后重新运行 npm i
。
方法二:将您的 x-code 版本降级到 12.4。它也适用于我
【讨论】:
以上是关于在纱线安装期间构建排毒失败的主要内容,如果未能解决你的问题,请参考以下文章