ios - React Native 无效的 podfile "No such file or directory - ./node_modules/.bin/react-native."

标签 ios node.js react-native cocoapods

在我的 iOS 目录中的 react native 项目 react-native@60.5 中,我在运行 pod install 时遇到了这个问题

[!] Invalid `Podfile` file: No such file or directory - ./node_modules/.bin/react-native.

 #  from /Users/username/appname/ios/Podfile:44
 #  -------------------------------------------
 #  
 >    use_native_modules!
 #  end
 #  -------------------------------------------

这是来自 >@60.0 的 React Native 新初始化;在我清除缓存并使用以下命令安装 node_modules 之前,一切都很完美 - 这可能不是必需的,或者对我来说是一个很好的举措。

watchman watch-del-all && 
rm -rf $TMPDIR/react-native-packager-cache-* &&
rm -rf $TMPDIR/metro-bundler-cache-* && 
rm -rf node_modules/ 
&& npm cache clean --force &&
npm install && 
npm start -- --reset-cache

这是我的播客文件

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'XXX' do
  # Pods for XXX
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  # Required by RNFirebase
  pod 'Firebase/Core', '~> 6.3.0'
  pod 'Firebase/Auth', '~> 6.3.0'
  pod 'Firebase/Firestore', '~> 6.3.0'

  pod 'GoogleIDFASupport', '~> 3.14.0'
  pod 'Fabric', '~> 1.10.2'
  pod 'Crashlytics', '~> 3.13.2'

  target 'XXXTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'XXX-tvOS' do
  # Pods for XXX-tvOS

  target 'XXX-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

这是我的 package.json

{
  "name": "XXX",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@gigasz/react-native-sketch-canvas": "github:jramalho/react-native-sketch-canvas",
    "@react-native-community/async-storage": "1.6.1",
    "@react-native-community/geolocation": "2.0.2",
    "@react-native-community/netinfo": "4.2.0",
    "@react-native-mapbox-gl/maps": "7.0.1",
    "@turf/turf": "5.1.6",
    "awaity": "1.0.0",
    "base-64": "0.1.0",
    "d3-scale": "3.1.0",
    "deepmerge": "4.0.0",
    "jetifier": "^1.6.4",
    "mobx": "5.13.0",
    "mobx-react": "6.1.3",
    "moment": "2.24.0",
    "prop-types": "15.7.2",
    "react": "16.8.6",
    "react-native": "0.60.5",
    "react-native-device-info": "2.3.2",
    "react-native-firebase": "5.5.6",
    "react-native-fs": "2.14.1",
    "react-native-gesture-handler": "1.4.1",
    "react-native-image-picker": "1.1.0",
    "react-native-image-progress": "1.1.1",
    "react-native-indicators": "0.13.0",
    "react-native-masked-text": "1.13.0",
    "react-native-modal-datetime-picker": "7.5.0",
    "react-native-paper": "2.16.0",
    "react-native-pdf": "5.1.4",
    "react-native-shake": "3.3.1",
    "react-native-status-bar-height": "2.4.0",
    "react-native-svg": "9.8.4",
    "react-native-svg-charts": "5.3.0",
    "react-native-vector-icons": "6.6.0",
    "react-navigation": "4.0.0",
    "react-navigation-material-bottom-tabs": "1.1.1",
    "react-navigation-stack": "^1.5.1",
    "rn-fetch-blob": "0.10.16",
    "uuid": "3.3.3"
  },
  "devDependencies": {
    "@babel/core": "7.5.5",
    "@babel/runtime": "7.5.5",
    "@react-native-community/eslint-config": "0.0.5",
    "babel-jest": "24.9.0",
    "babel-plugin-transform-remove-console": "6.9.4",
    "eslint": "6.3.0",
    "jest": "24.9.0",
    "metro-react-native-babel-preset": "0.54.1",
    "react-test-renderer": "16.8.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

我的 CI 构建系统仍然可以使用相同的 podfile 和 package.json 正常工作

任何帮助将不胜感激!

最佳答案

确保你在/ios 文件夹中 - pod install --project-directory=ios 对我来说崩溃了,但在/ios pod install 中工作正常!

关于ios - React Native 无效的 podfile "No such file or directory - ./node_modules/.bin/react-native.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57799719/

相关文章:

react-native - react-native 中基于设备的 SplitView(仅适用于平板电脑和 iPad)

ios - Unity3d 编辑器和 iPhone6 设备上的 Sha1 hash 不同

ios - 打印出结果后执行 Alamofire 请求

node.js - 需要一个包含index.js的文件夹

node.js - 如何在nodejs mongodb中使用聚合后更新数据

ios - xcodebuild 失败,返回码为 : 65 - using CLI/Appcenter but no error messages

ios - 尝试访问 long double Math 宏和 long double 的精度

ios - 我通过协议(protocol)将数据从 UITableViewController 传递到 UIViewController,而不是 int 值,我得到的是 nil。为什么?

javascript - Vue如何解决Uncaught SyntaxError : Function statements require a function name

android - 要求和内存消耗