React Native 0.64 命令 PhaseScriptExecution 失败,退出代码非零

The*_*ans 10 mobile ios react-native

我正在安装一个带有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
Run Code Online (Sandbox Code Playgroud)

这是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
Run Code Online (Sandbox Code Playgroud)

请注意,我的node_modules/react-native 中没有“ scripts ”文件夹(我只有 assets、normalize-color 和 polyfills 文件夹)。我试图删除节点模块并重新安装它。

我的规格是:

iOS Big Sur v. 11.2.3

XCode v.12.3

反应本机v.0.64

CocoaPods v. 1.10.1

节点v. 12.14.1

有什么帮助吗?谢谢。

Ama*_*sal 4

经过几个小时的调试后,我找到了解决方案,您现在需要修改此文件。

  1. 编辑此文件/node_modules/react-native/React/FBReactNativeSpec/../../scripts/generate-specs.sh
  2. 添加这一行export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
  3. 然后使用Xcode运行该项目,它将 100% 工作