ios - React Native 0.64 命令 PhaseScriptExecution 失败,退出代码非零
问题描述
我正在使用React Native 0.64安装一个带有一堆模块的新项目。我可以毫无问题地进行pod 安装,但是当我想让我的应用程序运行(使用 react-native run-ios 或使用 XCode)时,XCode 上发生了此错误:
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: readlink: command not found
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: dirname: command not found
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: cd: : No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
这个在react-native run-ios上:
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/thomas/Library/Developer/Xcode/DerivedData/appname-aqbmfgqjkshyqmaprdvggqaeqjrp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/**FBReactNativeSpec**.build/Script-A319AA7F2B7AAE771AE63D66A0049241.sh
请注意,我的node_modules/react-native中没有“脚本”文件夹(我只有 assets、normalize-color 和 polyfills 文件夹)。我试图删除节点模块并重新安装它。
我的规格是:
iOS 大苏尔v. 11.2.3
XCode v.12.3
反应原生v.0.64
CocoaPods v. 1.10.1
节点诉 12.14.1
有什么帮助吗?谢谢。
解决方案
经过数小时的调试后,我找到了解决方案,您现在需要修改此文件。
- 编辑此文件
/node_modules/react-native/React/FBReactNativeSpec/../../scripts/generate-specs.sh
- 添加这一行
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
- 然后使用Xcode运行项目,它将 100%运行
推荐阅读
- php - 如何用 php chmod 0007 很多目录?
- amazon-web-services - How to use AWS Route53 Reusable-Delegation Set when my domain is registered with GoDaddy?
- c# - 如何检查授权过程中的自定义属性(策略或中间件)?
- javascript - 切换大小写接受来自文本框的值
- ios - 在 iPhone X 应用程序因“NSUnknownKeyException”而崩溃,原因:“[
我的应用程序有一个故事板,它内置于 Objective C。这个应用程序在所有其他设备上都可以正常工作,但仅适用于 iPhone x 它崩溃的原因是:
由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[<UIStatusBar_Mo
- android-fragments - 如何取消订阅 RxKotlin/RxJava 中的 Flowable?
- c++ - 静态 std::unordered_map 的默认值
- sql - PostgreSQL 输出到 JSON 对象/数组
- symfony - Symfony QueryBuilder setParameters 替换值
- css - 在 webkit 中调整中文