Xcode 10 中的 Permission Denied 错误阻止 Build...Command PhaseScriptExecution 失败,退出代码为非零
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53783142/
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
Permission Denied error in Xcode 10 preventing Build...Command PhaseScriptExecution failed with a nonzero exit code
提问by James LCQ
I'm unable to Build/Archive my project due to an error:
由于错误,我无法构建/归档我的项目:
Permission denied
Command PhaseScriptExecution failed with a nonzero exit code
权限被拒绝
命令 PhaseScriptExecution 失败,退出代码非零
I have tried correcting keychain login as advised by other answers, but it hasn't worked. Please could someone help? Most likely a rookie mistake but means I cannot even simulate my app.
我已尝试按照其他答案的建议更正钥匙串登录,但没有奏效。请问有人可以帮忙吗?很可能是新手错误,但这意味着我什至无法模拟我的应用程序。
Further details on the error:
有关错误的更多详细信息:
PhaseScriptExecution Copy\ Pods\ Resources
/Users/james/Library/Developer/Xcode/DerivedData/trials-fseuxkwjlleukxdxyfgdrujhdwuy/Build/Intermediates.noindex/trials.build/Debug-iphonesimulator/trials.build/Script-8DEE2FC97BFA0D6E636019C4.sh (in target: trials)
cd /Users/james/pCloud\ Drive/3.\ NeuroRecovery\ Ltd/4.\ Products/3.\ NIHR\ Trial\ NHS/v1.0\ -\ Initial\ App/1.\ App\ Delivery/3.\ Source\ Code/1.\ iOS/trials
/bin/sh -c /Users/james/Library/Developer/Xcode/DerivedData/trials-fseuxkwjlleukxdxyfgdrujhdwuy/Build/Intermediates.noindex/trials.build/Debug-iphonesimulator/trials.build/Script-8DEE2FC97BFA0D6E636019C4.sh
/Users/james/Library/Developer/Xcode/DerivedData/trials-fseuxkwjlleukxdxyfgdrujhdwuy/Build/Intermediates.noindex/trials.build/Debug-iphonesimulator/trials.build/Script-8DEE2FC97BFA0D6E636019C4.sh: line 2: /Users/james/pCloud Drive/3. NeuroRecovery Ltd/4. Products/3. NIHR Trial NHS/v1.0 - Initial App/1. App Delivery/3. Source Code/1. iOS/trials/Pods/Target Support Files/Pods-trials/Pods-trials-resources.sh: Permission denied
Command PhaseScriptExecution failed with a nonzero exit code
Edit 17th Dec: thank you @geno-chen & @fantini I have checked & can report the following:
12 月 17 日编辑:谢谢@geno-chen & @fantini 我已经检查并可以报告以下内容:
Did you install Cocoapods with sudo: Yes.
I checked the permissions of the files using ls -lh and had the following: -rw-r--r-- 1 james staff 159B 25 Mar 2015 Podfile -rw-r--r-- 1 james staff 1.2K 25 Mar 2015 Podfile.lock drwxr-xr-x 11 james staff 352B 17 Dec 14:03 Pods drwxr-xr-x 52 james staff 1.6K 17 Dec 14:03 trials drwxr-xr-x@ 5 james staff 160B 17 Dec 14:03 trials.xcodeproj drwxr-xr-x@ 5 james staff 160B 17 Dec 14:03 trials.xcworkspace drwxr-xr-x 4 james staff 128B 17 Dec 14:03 trialsTests
I used chmod to modify permissions of the podfiles as below: -rwxr-xr-x 1 james staff 159B 25 Mar 2015 Podfile -rwxr-xr-x 1 james staff 1.2K 25 Mar 2015 Podfile.lock drwxr-xr-x 11 james staff 352B 17 Dec 14:03 Pods drwxr-xr-x 52 james staff 1.6K 17 Dec 14:03 trials drwxr-xr-x@ 5 james staff 160B 17 Dec 14:03 trials.xcodeproj drwxr-xr-x@ 5 james staff 160B 17 Dec 14:03 trials.xcworkspace drwxr-xr-x 4 james staff 128B 17 Dec 14:03 trialsTests
您是否使用 sudo 安装了 Cocoapods:是的。
我使用 ls -lh 检查了文件的权限,结果如下:-rw-r--r-- 1 james staff 159B 25 Mar 2015 Podfile -rw-r--r-- 1 james staff 1.2K 25 Mar 2015 Podfile.lock drwxr-xr-x 11 名 james 员工 352B 12 月 17 日 14:03 Pods drwxr-xr-x 52 名 james 员工 1.6K 12 月 17 日 14:03 试验 drwxr-xr-x@ 5 名 james 员工 160B 12 月 17 日 14:03 试验.xcodeproj drwxr-xr-x@ 5 名詹姆斯工作人员 160B 12 月 17 日 14:03 试验.xcworkspace drwxr-xr-x 4 名詹姆斯工作人员 128B 12 月 17 日 14:03 试验测试
我使用 chmod 修改 podfiles 的权限如下: -rwxr-xr-x 1 james staff 159B 25 Mar 2015 Podfile -rwxr-xr-x 1 james staff 1.2K 25 Mar 2015 Podfile.lock drwxr-xr-x 11 james工作人员 352B 12 月 17 日 14:03 Pods drwxr-xr-x 52 名詹姆斯工作人员 1.6K 12 月 17 日 14:03 试验 drwxr-xr-x@ 5 名詹姆斯工作人员 12 月 17 日 14:03 试验.xcodeproj drwxr-xr-x@工作人员 160B 12 月 17 日 14:03 试验.xcworkspace drwxr-xr-x 4 詹姆斯工作人员 128B 12 月 17 日 14:03 试验测试
I then Cleaned my Build Folder, restarted but still have the same error.
然后我清理了我的构建文件夹,重新启动但仍然有相同的错误。
回答by Sawsan
I fixed the permission problem by running the following command.
我通过运行以下命令修复了权限问题。
chmod +x "Path to .sh"
Please replace ProjectName
with your project name and username
with your username
请替换ProjectName
为您的项目名称和username
用户名
chmod +x /Users/username/Documents/ProjectName/Pods/Target\ Support\ Files/Pods-ProjectName/Pods-ProjectName-frameworks.sh
You can get the path from your xcode project as explained by step 1 to 3
您可以从您的 xcode 项目中获取路径,如步骤 1 到 3 所述
回答by andrew54068
I've tried @Sawsan method but get no luck even the file is already executable.
我试过@Sawsan 方法,但即使文件已经可以执行也没有运气。
Here is the step I solve:
这是我解决的步骤:
1.delete Podfile.lock
1.删除Podfile.lock
2.delete Pods directory
2.删除Pods目录
3.delete .xcworkspace file
3.删除.xcworkspace文件
4.Pod install again
4.再次安装Pod
that's it.
就是这样。
give it a try!
试一试!
回答by Priyank Gandhi
I have to own a trial for this solution and I got a proper result.
我必须对这个解决方案进行试验,我得到了正确的结果。
Follow the step:
请按照以下步骤操作:
1) Open Terminal and set a project path
1)打开终端并设置项目路径
"pod deintegrate"command executes
“pod deintegrate”命令执行
2) Then after "pod install"command executes.
2)然后在“pod install”命令执行之后。