ios React Native 构建命令失败:PhaseScriptExecution ...(域=NSPOSIXErrorDomain,代码=2)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35243601/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
React Native Build Commands Failed: PhaseScriptExecution ... (domain=NSPOSIXErrorDomain, code=2)
提问by Lorem Ipsum Dolor
Environment
环境
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
What I did before running the app
在运行应用程序之前我做了什么
npm install -g react-native-cli
react-native init DemoProjectDELETEME
cd ./DemoProjectDELETEME
react-native run-ios
I am new to React Native. When I try to run the default app on iOS simulator I got the following errors. I found a similar issue but it does not solve my problem.
我是React Native 的新手。当我尝试在 iOS 模拟器上运行默认应用程序时,出现以下错误。我发现了一个类似的问题,但它并没有解决我的问题。
Xcode6 can't run any app in simulator ( Domain = NSPOSIXErrorDomain, Code = 3 )
Xcode6 无法在模拟器中运行任何应用程序( Domain = NSPOSIXErrorDomain, Code = 3 )
After restart the machine and simulator the issues still persistent.
重新启动机器和模拟器后,问题仍然存在。
** 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)
Got the follower error when I am trying to launch the app from Xcode.
当我尝试从 Xcode 启动应用程序时出现跟随者错误。
sudo npm start
in project root solves the issue, but react-native run-ios
still BUILD FAILED.
sudo npm start
在项目 root 中解决了这个问题,但react-native run-ios
仍然BUILD FAILED。
Thanks for your time viewing my question.
感谢您抽出时间查看我的问题。
采纳答案by Nima Izadi
Try running react-native upgrade
尝试跑步 react-native upgrade
See Github thread: https://github.com/facebook/react-native/issues/7308#issuecomment-219597774
见 Github 线程:https: //github.com/facebook/react-native/issues/7308#issuecomment-219597774
回答by phani
For me port 8081 was in use :
对我来说,8081 端口正在使用中:
lsof -n -i4TCP:8081
lsof -n -i4TCP:8081
回答by Katta Nagarjuna
回答by Steve Potter
The problem is in the js file that builds and runs your app. Unless your project, scheme, and Product Name are all the same, you'll get errors, especially on simulators.
问题出在构建和运行您的应用程序的 js 文件中。除非您的项目、方案和产品名称都相同,否则您会遇到错误,尤其是在模拟器上。
The good news is that I submitted a pull request that fixes the problem.Please go upvote it so we don't have worry about things breaking when we rename things.
好消息是我提交了一个解决问题的拉取请求。请给它点赞,这样我们就不用担心重命名时会损坏。
回答by Aathi
回答by damien murphy.
回答by Lorem Ipsum Dolor
Adding sudo
in front of all commands solves the problem.
sudo
在所有命令前面添加即可解决问题。
sudo react-native init ProjectName
sudo chmod 777 ProjectName
cd ProjectName
sudo react-native run-ios
回答by Matt D. Webb
For me, I needed to upgrade my version of XCode
from Yosemite to Sierra.
对我来说,我需要将我的版本XCode
从优胜美地升级到 Sierra。
This can be done via App Store
> Updates
.
这可以通过App Store
>来完成Updates
。
回答by Amanda meng
I fixed my issue, you can try it if you are in the same condition.
我解决了我的问题,如果您处于相同的情况,您可以尝试一下。
I encountered the same error:
我遇到了同样的错误:
Print: Entry, ":CFBundleIdentifier", Does Not Exist
打印:条目,“:CFBundleIdentifier”,不存在
When I clone an existing react-native project from learning react native.
当我从学习 react native克隆现有的 react-native 项目时。
I initialize (using
{react-native init yourProjectName}
) a new project with the same name in a different directorycopy every useful *.ios.js file to this new project from the one I clone elsewhere.
我
{react-native init yourProjectName}
在不同的目录中初始化(使用)一个同名的新项目将所有有用的 *.ios.js 文件从我在别处克隆的文件复制到这个新项目。
This works for me.
这对我有用。
回答by Sachin Kumaram
Edit the file ,ProjectName/node_modules/react-native/local-cli/runIOS/runIOS.js Line no 18 : replace the entire line of code with the following :
编辑文件 ,ProjectName/node_modules/react-native/local-cli/runIOS/runIOS.js 第 18 行:将整行代码替换为以下内容:
return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
Line no: 146: uncomment '-derivedDataPath', 'build',
第 146 行:取消注释 '-derivedDataPath', 'build',
after that run the command from the terminal: sudo react-native run-ios
之后从终端运行命令:sudo react-native run-ios