当我pod install在我的反应本机项目中运行时,我收到此错误-
!] /usr/bin/bash -c \nset -e\n#!/bin/bash\n# Copyright (c) Facebook, Inc. and its affiliates.\n#\n# This source code is licensed under the MIT license found in the\n# LICENSE file in the root directory of this source tree.\n\nset -e\n\nPLATFORM_NAME="${PLATFORM_NAME:-iphoneos}"\nCURRENT_ARCH="${CURRENT_ARCH}"\n\nif [ -z "$CURRENT_ARCH" ] || [ "$CURRENT_ARCH" == "undefined_arch" ]; then\n # Xcode 10 beta sets CURRENT_ARCH to "undefined_arch", this leads to incorrect linker arg.\n # it\'s better to rely on platform name as fallback because architecture differs between simulator and device\n\n if [[ "$PLATFORM_NAME" == *"simulator"* ]]; then\n CURRENT_ARCH="x86_64"\n else\n CURRENT_ARCH="arm64"\n fi\nfi\n\nexport CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"\nexport CXX="$CC"\n\n# Remove automake symlink if it exists\nif [ -h "test-driver" ]; then\n rm test-driver\nfi\n\n# Manually disable gflags include to fix issue https://github.com/facebook/react-native/issues/28446\nsed -i \'\' \'s/\\@ac_cv_have_libgflags\\@/0/\' src/glog/logging.h.in\nsed -i \'\' \'s/HAVE_LIB_GFLAGS/HAVE_LIB_GFLAGS_DISABLED/\' src/config.h.in\n\n./configure --host arm-apple-darwin\n\ncat << EOF >> src/config.h\n/* Add in so we have Apple Target Conditionals */\n#ifdef __APPLE__\n#include <TargetConditionals.h>\n#include <Availability.h>\n#endif\n\n/* Special configuration for ucontext */\n#undef HAVE_UCONTEXT_H\n#undef PC_FROM_UCONTEXT\n#if defined(__x86_64__)\n#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip\n#elif defined(__i386__)\n#define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip\n#endif\nEOF\n\n# Prepare exported header include\nEXPORTED_INCLUDE_DIR="exported/glog"\nmkdir -p exported/glog\ncp -f src/glog/log_severity.h "$EXPORTED_INCLUDE_DIR/"\ncp -f src/glog/logging.h "$EXPORTED_INCLUDE_DIR/"\ncp -f src/glog/raw_logging.h "$EXPORTED_INCLUDE_DIR/"\ncp -f src/glog/stl_logging.h "$EXPORTED_INCLUDE_DIR/"\ncp -f src/glog/vlog_is_on.h "$EXPORTED_INCLUDE_DIR/"\n\n/usr/bin/bash: line 25: xcrun: command not found\n/usr/bin/bash: line 25: xcrun: command not found\nsed: can\'t read s/\\@ac_cv_have_libgflags\\@/0/: No such file or directory\nRun Code Online (Sandbox Code Playgroud)\n\n我的播客文件
\nrequire_relative \'../node_modules/react-native/scripts/react_native_pods\'\nrequire_relative \'../node_modules/@react-native-community/cli-platform-ios/native_modules\'\n\nplatform :ios, \'11.0\'\n\ntarget \'NewApp\' do\n config = use_native_modules!\n\n use_react_native!(\n :path => config[:reactNativePath],\n # to enable hermes on iOS, change `false` to `true` and then install pods\n :hermes_enabled => false\n )\n\n target \'NewApp\' do\n inherit! :complete\n # Pods for testing\n end\n\n # Enables Flipper.\n #\n # Note that if you have use_frameworks! enabled, Flipper will not work and\n # you should disable the next line.\n # use_flipper!()\n\n # post_install do |installer|\n # react_native_post_install(installer)\n # __apply_Xcode_12_5_M1_post_install_workaround(installer)\n # end\nend\nRun Code Online (Sandbox Code Playgroud)\n\n我的package.json
\n{\n "name": "NewApp",\n "version": "0.0.1",\n "private": true,\n "scripts": {\n "android": "react-native run-android",\n "ios": "react-native run-ios",\n "start": "react-native start",\n "test": "jest",\n "lint": "eslint ."\n },\n "dependencies": {\n "react": "17.0.2",\n "react-native": "^0.67.3",\n "react-native-fs": "^2.19.0",\n "react-native-permissions": "^3.3.0"\n },\n "devDependencies": {\n "@babel/core": "^7.17.5",\n "@babel/runtime": "^7.17.2",\n "@react-native-community/eslint-config": "^3.0.1",\n "babel-jest": "^27.5.1",\n "eslint": "^8.10.0",\n "jest": "^27.5.1",\n "metro-react-native-babel-preset": "^0.69.0",\n "react-test-renderer": "17.0.2"\n },\n "jest": {\n "preset": "react-native"\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n我的系统
\n我使用的是Linux系统。
\nLinux user 5.16.0-kali1-amd64 #1 SMP PREEMPT Debian 5.16.7-2kali1 (2022-02-10) x86_64 GNU/Linux\nRun Code Online (Sandbox Code Playgroud)\n版本
\nnode: v16.14.0\nreact-native-cli: 2.0.1\nreact-native: "0.67.3"\nreact: "17.0.2",\nRun Code Online (Sandbox Code Playgroud)\n我该如何解决这个错误?我只想开发 Android 应用程序。但是当我运行时react-native start我收到此错误-
\n\n错误:react-native-permissions:NativeModule.RNPermissions 为空。要解决此问题,请尝试以下步骤:\n\xe2\x80\xa2 如果您在 iOS 上使用 CocoaPods,请
\npod install在ios目录中运行,然后清理、重建并重新运行应用程序。您可能还需要重新打开 Xcode 才能获取新的 pod。
我可以暂时跳过 ios 部分并仅构建 Android 应用程序吗?或者如何解决 pod 安装错误?请帮忙!
\n小智 7
就我而言,安装的 sed 版本是问题所在。React Native 假定 macos 上默认安装了 sed,它能够处理以下表达式:
sed -i '' 's/\@ac_cv_have_libgflags\@/0/' src/glog/logging.h.in
Run Code Online (Sandbox Code Playgroud)
在我的 CI 系统上,我安装了 gnu-sed,这导致了上述错误。
检查您的系统并确保sed指向默认的 Macos 安装 ( /usr/bin/sed)。如果您需要 gnu-sed 用于其他脚本(在我的例子中,我需要在版本控制脚本中使用 gnu-sed 特定语法),您可以将其与 brew 并排安装:
brew install gnu-sed
您可以使用 来调用 gnu-sed gsed。
华泰
| 归档时间: |
|
| 查看次数: |
2658 次 |
| 最近记录: |