反应本机无效的Podfile“没有这样的文件或目录-./node_modules/.bin/react-native”。 [英] React Native invalid podfile "No such file or directory - ./node_modules/.bin/react-native."

查看:185
本文介绍了反应本机无效的Podfile“没有这样的文件或目录-./node_modules/.bin/react-native”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的React native项目iOS-dir中的react-native@60.5中,我在运行Pod安装时遇到了这个问题

In my react native project react-native@60.5 in the iOS dir I get this issue when running a 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为止-可能这并不是必需的,或者对我而言不是一个好办法。

This is a React Native fresh init from >@60.0; All worked perfect until I cleared my cache and installed node_modules with the following commands - this may have not been necessary or a good move on my part.

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

这是我的podfile

Here is my podfile

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

Here is my 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和包中正常工作.json

My CI build system still works fine with the same podfile and package.json

任何帮助将不胜感激!

推荐答案

我可以通过在包含我的 Podfile 的文件夹中的文件夹中创建我的 node_modules 的符号链接来解决此问题(很抱歉冗长!)。就我而言,我有一个非标准的设置,如下所示:

I'm able to workaround this by creating a symlink to my node_modules in the folder containing the folder containing my Podfile (sorry for the wordiness!). In my case, I have an non-standard setup which looks like:

  projectFolder/
    Podfile
    app.xcworkspace
    ...
    rn/
      package.json
      node_modules/
      yarn.lock
      ios --> symlink to projectFolder/
      ...

而我的解决方法是这样做: / p>

And my hacky workaround is to do this:

    parentFolder/
      node_modules --> symlink to projectFolder/rn/node_modules
      projectFolder/
        ... (all the stuff from above) ...

必须有更好的方法。 (就我而言,也许只需遵循标准设置即可!)

There must be a better way. (In my case, perhaps just follow the standard setup!)

这篇关于反应本机无效的Podfile“没有这样的文件或目录-./node_modules/.bin/react-native”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆