React Native Build命令失败:PhaseScriptExecution …(domain = NSPOSIXErrorDomain,code = 2)

环境

Mac OS X Version 10.11.3 (15D21) Xcode Version 7.2 (7C68) Simulator Version 9.2 (SimulatorApp-643) react-native-cli 0.1.10 node v5.5.0 

我在运行应用程序之前做了什么

 npm install -g react-native-cli react-native init DemoProjectDELETEME cd ./DemoProjectDELETEME react-native run-ios 

我是React Native的新手。 当我尝试在iOS模拟器上运行默认应用程序时,出现以下错误。 我发现了类似的问题,但它不能解决我的问题。

Xcode6无法在模拟器中运行任何应用程序(Domain = NSPOSIXErrorDomain,Code = 3)

重启机器和模拟器后,问题仍然存在。

 ** BUILD FAILED ** The following build commands failed: PhaseScriptExecution Run\ Script /Users/x/Desktop/DemoProjectDELETEME/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Script-006B79A01A781F38006873D1.sh (1 failure) Installing build/Build/Products/Debug-iphonesimulator/DemoProjectDELETEME.app An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2): Failed to install the requested application An application bundle was not found at the provided path. Provide a valid path to the desired application bundle. Print: Entry, ":CFBundleIdentifier", Does Not Exist /Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/done.js:10 throw err; ^ Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/DemoProjectDELETEME.app/Info.plist Print: Entry, ":CFBundleIdentifier", Does Not Exist at checkExecSyncError (child_process.js:464:13) at Object.execFileSync (child_process.js:484:13) at _runIOS (runIOS.js:77:34) at runIOS.js:24:5 at tryCallTwo (/Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/core.js:45:5) at doResolve (/Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/core.js:200:13) at new Promise (/Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/core.js:66:3) at Array.runIOS (runIOS.js:23:10) at Object.run (/Users/x/Desktop/DemoProjectDELETEME/node_modules/react-native/local-cli/cli.js:86:13) at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:73:7) 

当我尝试从Xcode启动应用程序时得到跟随者错误。

在这里输入图像说明

sudo npm start在项目根目录下解决了这个问题,但是react-native run-ios仍然是BUILD FAILED

感谢您的时间查看我的问题。

尝试运行react-native upgrade

请参阅Github主题: https : //github.com/facebook/react-native/issues/7308#issuecomment-219597774

对于我8081端口正在使用中:

lsof -n -i4TCP:8081

1.进入文件 – >项目设置2.点击高级button3.select“自定义”,然后在下拉菜单中select“相对于工作区”4.将“Build / Products”更改为“build / Build / Products”点击完成,完成 在这里输入图像说明

  1. 在Xcode中打开您的react-native项目
  2. 用项目名称创build一个新的模式。
  3. 问题就解决了 在这里输入图像说明

问题是在构build和运行您的应用程序的js文件。 除非你的项目,scheme和产品名称都是一样的,否则会出现错误,特别是在模拟器上。

好消息是我提交了一个解决问题的请求。 请上去吧,所以当我们重命名的东西时,我们不用担心事情会中断。

在所有命令前添加sudo解决了这个问题。

 sudo react-native init ProjectName sudo chmod 777 ProjectName cd ProjectName sudo react-native run-ios 

对我来说,我只需要编辑iOS项目构build设置

产品包标识符未被设置

您需要将其设置为“项目”和“2个目标”

在这里输入图像说明

对我而言,我需要将我的XCode版本从Yosemite升级到Sierra。

这可以通过App Store > Updates来完成。

打开你的Xcode项目

运行

你应该从RCTSRWebSocket.m有2个错误

添加(void)到两行的开头:

 SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key); 

成为

 (void)SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key); 

使用Xcode或terminal保存并重新运行您的项目。 它应该工作肯定。 我已经testing过所有的解决scheme,这个是唯一为我工作的人。

令人惊讶的是,这是我的解决scheme:在Xcode中打开Views / RTCScrollView.m文件,并将variables_refreshControl更改为refreshControl 。 所有出现的_refreshControl都已经标记为错误。 新的代码变成:

 - (void)setRefreshControl:(RCTRefreshControl *)refreshControl { if (refreshControl) { [refreshControl removeFromSuperview]; } refreshControl = refreshControl; [self addSubview:refreshControl]; } 

我解决了我的问题,如果你处于相同的状况,你可以试试。

我遇到了同样的错误:

打印:条目“:CFBundleIdentifier”不存在

当我克隆现有的反应原生项目从学习反应原生 。

  1. 我在一个不同的目录中初始化(使用{react-native init yourProjectName} )一个同名的新项目

  2. 将每一个有用的* .ios.js文件复制到我在其他地方克隆的这个新项目。

这对我有用。

编辑文件,ProjectName / node_modules / react-native / local-cli / runIOS / runIOS.js第18行:用以下代码replace整行代码:

 return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`; 

行号:146:取消注释'-derivedDataPath', 'build',

之后,从terminal运行命令:sudo react-native run-ios

这可能是由于几个错误或缺less引用。 对于你提到的错误之一,你可以修复像我提到的下面

错误

  ** BUILD FAILED ** The following build commands failed: > PhaseScriptExecution Run\ Script /Users/x/Desktop/DemoProjectDELETEME/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Script-006B79A01A781F38006873D1.sh > (1 failure) 

首先,find"react-native-xcode.sh"脚本在哪里? 它可以在

 YourProject > node_modules > react-native > scripts > 

要么

 YourProject > node_modules > react-native > packager > 

然后将正确的path添加到X代码构buildconfiguration中,如下所示 Xcode配置

使用下面的任一行

 export NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh export NODE_BINARY=node ../node_modules/react-native/packager/react-native-xcode.sh 

现在清理编译并运行并修复你得到的其他错误。