【问题标题】:How can I solve this " Invalid `Podfile` " error?我该如何解决这个“Invalid `Podfile`”错误?
【发布时间】:2020-06-24 23:17:30
【问题描述】:

我是 ios 开发的新手,我从另一个开发人员那里获得了一个用于 ios 项目的 zip 文件。当我运行 pod install 时,终端显示此错误:

[!] Invalid `Podfile` file: cannot load such file -- /Users/abc/Desktop/node_modules/@react-native-community/cli-platform-ios/native_modules.

 #  from /Users/abc/Desktop/ios/Podfile:2
 #  -----------------------------------------
 #  platform :ios, '9.0'
 >  require_relative '../node_modules/@react- 
 native-community/cli-platform- 
 ios/native_modules'
 #  
 #  ----------------------------------------- 
           

目录是这样的
~/桌面/ios
ls

GoogleService-Info.plist ISApp.xcodeproj          
Podfile.lock
ISApp                    ISApp.xcworkspace        
Pods
ISApp-tvOS               ISAppTests               
instrumentscli0.trace
ISApp-tvOSTests          Podfile

我查看了下面的主题,但它根本没有帮助。任何输入表示赞赏。
react-native ios Podfile issue with "use_native_modules!"

【问题讨论】:

  • 我想这可以回答你的问题stackoverflow.com/questions/56917963/…
  • 在提问之前我已经看过帖子了。但是,我被困在第 2 步。我尝试安装 package.js、cli-platform-ios/native_modules,并运行了 yarn install,但错误仍然存​​在。我错过了什么吗?

标签: ios react-native


【解决方案1】:

您需要提供 podfile 的内容。您的 podfile 可能格式不正确。如果是,一种解决方法可能是将您的 podfile 移动到其他位置,卸载并重新安装 cocoapods(sudo gem uninstall cocoapodssudo gem install cocoapods),初始化 pod(pod init),复制 podfile 的内容(确保格式没有搞砸)到新的 podfile,然后再次安装 pod(pod install)。

【讨论】:

    猜你喜欢
    • 2016-07-21
    • 2016-09-09
    • 2015-02-28
    • 2013-08-16
    • 2020-04-17
    • 1970-01-01
    相关资源
    最近更新 更多