xcode react-native“Segmentation fault:11 bash -l -c.”when build app

oug3syen  于 2023-11-21  发布在  React
关注(0)|答案(1)|浏览(134)

我想要的是

在react-native yarn run:ios当我尝试启动现有应用时,出现错误,无法正常工作。

premise

执行环境如下。

System:
    OS: macOS 13.6
    CPU: (8) arm64 Apple M1
    Memory: 179.06 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node
    Yarn: 1.22.19 - ~/.nodebrew/current/bin/yarn
    npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm
    Watchman: 2023.09.18.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /Users/teraichi/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.3 AI-223.8836.35.2231.10671973
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: javac 21 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.64.4 => 0.64.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

字符串

出现问题/错误消息

下面是从xCode构建时出现的错误消息的摘录。

PhaseScriptExecution [CP-User]\ Generate\ Specs 
/Users/teraichi/Library/Developer/Xcode/DerivedData/Cucom-
basegvsyhmpmsgdvjavywleoezbw/Build/Intermediates.noindex/Pods.build/Debug-
iphonesimulator/FBReactNativeSpec.build/Script-9666B301DB9D9BA74C1C0CDD9B765E7B.sh 
(in target 'FBReactNativeSpec' from project 'Pods')

...

/Users/teraichi/Library/Developer/Xcode/DerivedData/Cucom-
basegvsyhmpmsgdvjavywleoezbw/Build/Intermediates.noindex/Pods.build/Debug-
iphonesimulator/FBReactNativeSpec.build/Script-9666B301DB9D9BA74C1C0CDD9B765E7B.sh: 
line 4: 23095 Segmentation fault: 11  bash -l -c 'SRCS_DIR=/Users/teraichi/Work/Cucom-App-
v2/node_modules/react-native/scripts/../Libraries 
CODEGEN_MODULES_OUTPUT_DIR=/Users/teraichi/Work/Cucom-App-v2/node_modules/react-
native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec CODEGEN_MODULES_LIBRARY_NAME=
FBReactNativeSpec /Users/teraichi/Work/Cucom-App-
v2/node_modules/react-native/scripts/generate-specs.sh' 2>&1
     23096 Done                    | tee "${SCRIPT_OUTPUT_FILE_0}"
Command PhaseScriptExecution failed with a nonzero exit code


即使我从xCode或yarn构建,我也会得到同样的错误。

适用源码

# /Users/teraichi/Library/Developer/Xcode/DerivedData/Cucom-basegvsyhmpmsgdvjavywleoezbw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-9666B301DB9D9BA74C1C0CDD9B765E7B.sh

#!/bin/sh
set -o pipefail

bash -l -c 'SRCS_DIR=/Users/teraichi/Work/Cucom-App-v2/node_modules/react-native/scripts/../Libraries CODEGEN_MODULES_OUTPUT_DIR=/Users/teraichi/Work/Cucom-App-v2/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec CODEGEN_MODULES_LIBRARY_NAME=FBReactNativeSpec /Users/teraichi/Work/Cucom-App-v2/node_modules/react-native/scripts/generate-specs.sh' 2>&1 | tee "${SCRIPT_OUTPUT_FILE_0}"

我所尝试的

  • 重新启动计算机
  • OS版本升级
  • 更新xCode版本
  • 节点版本向上,版本向下
  • 互联网上发布的其他解决方案

引用的站点

存档时“Command PhaseScriptExecution failed with a nonzero exit code”(命令阶段脚本执行失败,退出代码为非零)
https://github.com/facebook/react-native/issues/34269

qq24tv8q

qq24tv8q1#

1.首先,在Xcode中选择Product > Clean Build Folder,尝试清理构建文件夹,然后再次尝试构建。

  1. Node模块可能没有正确安装,因此请尝试通过在项目目录中运行以下命令来重新安装模块:
rm -rf node_modules
npm install // or yarn install

字符串

  1. CocoaPods的安装可能有问题,请尝试在iOS项目目录中运行以下命令重新安装Pod:
cd ios
rm -rf Podfile.lock Pods
pod install

相关问题