简体   繁体   English

“Podfile”文件语法错误无效,意外$ undefined,期待'}'

[英]Invalid 'Podfile' file syntax error, unexpected $undefined, expecting '}'

I am trying to install a pod in project. 我正在尝试在项目中安装pod。 But i am getting this error: 但我得到这个错误:

Invalid 'Podfile' file syntax error, unexpected $undefined, expecting '}'. “Podfile”文件语法错误无效,意外$ undefined,期待'}'。

Podfile contains: Podfile包含:

platform :ios, '7.0' pod 'RestKit', '0.21.0'

The terminal shows following message: 终端显示以下消息:

[!] Invalid `Podfile` file: compile error
/Users/work/Desktop/tg/RESTKitDemo/Podfile:1: syntax error, unexpected $undefined, expecting '}'
{\rtf1\ansi\ansicpg1252\cocoartf1265
^. Updating CocoaPods might fix the issue.

#  from /Users/work/Desktop/tg/RESTKitDemo/Podfile:1
#  -------------------------------------------
>  {\rtf1\ansi\ansicpg1252\cocoartf1265
#  {\fonttbl\f0\fmodern\fcharset0 Courier;}
#  -------------------------------------------

Can i know what is the problem with my podfile? 我可以知道我的podfile有什么问题吗?

Assuming you correctly copied your Podfile over there needs to be a newline between those two lines. 假设您正确复制了Podfile,那么这两行之间需要有换行符。

platform :ios, '7.0'
pod 'RestKit', '0.21.0'

Also as of a relatively new version of CocoaPods you actually don't need that first line, the command line tool will determine the correct OS based off of your project's settings. 此外,作为一个相对较新版本的CocoaPods,您实际上不需要第一行,命令行工具将根据您的项目设置确定正确的操作系统。

Edit: 编辑:

From the new output you posted it looks like your Podfile isn't actually a plain text file. 从您发布的新输出看起来,您的Podfile实际上不是纯文本文件。 You should recreate it in an editor like Sublime Text and make sure it saves as a plain text file. 您应该在Sublime Text等编辑器中重新创建它,并确保它保存为纯文本文件。

I got error 我收到了错误

Invalid `Podfile` file: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
pod 'MBProgressHUD'

becasue I was declaring Pod files like 因为我正在声明像Pod这样的文件

pod 'SlideMenuControllerSwift',
pod 'MBProgressHUD'
pod 'SDWebImage'

there is one "," (colon mark) in above podfile name pod 'SlideMenuControllerSwift', . 上面的podfile名称pod“SlideMenuControllerSwift”中有一个“,”(冒号)。 I just removed the colon mark. 我刚删除了冒号。 It worked. 有效。

correct way: 正确方法:

pod 'SlideMenuControllerSwift'
pod 'MBProgressHUD'
pod 'SDWebImage'

pod文件中不允许使用任何特殊字符或任何其他内容,除了我们正在集成的pod的名称,如果我们输入任何字符,如\\,等等,它可能会导致以下错误。

I was faced same problem when, I changed my MAC. 当我改变我的MAC时,我遇到了同样的问题。

1- Make setup - Pod setup or update 1-进行设置 - Pod设置或更新

So I created a new test project -- And open terminal Run these command 所以我创建了一个新的测试项目 - 并打开terminal运行这些命令

cd /path your project
pod init
// add any pod in your pod file 
pod install

and then you can update pod in your old project . 然后您可以update pod旧项目中的update pod

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当安装pod时,ERROR“无效的`Podfile`文件:未定义的方法`plateform' - when install pod ,ERROR "Invalid `Podfile` file: undefined method `plateform' 无效的“Podfile”文件:套接字错误不支持操作 - Invalid `Podfile` file: Operation not supported on socket error React Native - iOS - 无效的`Podfile`文件:未定义的方法`[]'为nil:NilClass - React Native - iOS - Invalid `Podfile` file: undefined method `[]' for nil:NilClass 无效的“ Podfile”文件 - Invalid 'Podfile' file 无效的“Podfile”文件:未定义的方法“use_native_modules!” 为了 #<pod::podfile:0x007fd5795662a0></pod::podfile:0x007fd5795662a0> - Invalid `Podfile` file: undefined method `use_native_modules!' for #<Pod::Podfile:0x007fd5795662a0> 无效的`Podfile` 文件:未初始化的常量 - Invalid `Podfile` file: uninitialized constant 安装Firebase Pod错误无效Podfile - Installing Firebase pod error Invalid Podfile 如何解决这个“Invalid `Podfile`”错误? - How can I solve this “ Invalid `Podfile` ” error? Flutter iOS 在 App Center 上构建失败并出现错误:“无效的 Podfile 文件:Generated.xcconfig 必须存在 - Flutter iOS build on the App Center fails with error: "Invalid Podfile file: Generated.xcconfig must exist 尝试运行Pod安装时出现错误“无效的Podfile文件:未知的regexp选项-jackha。” - Error “Invalid `Podfile` file: unknown regexp options - jackha.” when trying to run pod install
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM