美文网首页
cocoapods 报错解决方案

cocoapods 报错解决方案

作者: Goldfish_jinyu | 来源:发表于2017-11-27 14:43 被阅读33次

遇到的问题

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

### Command

/Users/jinyu/.rvm/rubies/ruby-2.2.2/bin/pod install


### Report

* What did you do?

* What did you expect to happen?

* What happened instead?


### Stack

CocoaPods : 1.3.1
Ruby : ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
RubyGems : 2.6.14
Host : Mac OS X 10.12.6 (16G29)
Xcode : 9.1 (9B55)
Git : git version 2.13.6 (Apple Git-96)
Ruby lib dir : /Users/jinyu/.rvm/rubies/ruby-2.2.2/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 8de3190f9267808e87732f207646bf49f23ac77c


### Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.0
cocoapods-try : 1.1.0


### Podfile

```ruby
platform:ios, '8.0'
target ??ceshi1127?? do

pod'AFNetworking','~>3.1.0'

end

Error

ArgumentError - invalid byte sequence in UTF-8
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/gems/cocoapods-core-1.3.1/lib/cocoapods-core/podfile.rb:278:in `tr!'
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/gems/cocoapods-core-1.3.1/lib/cocoapods-core/podfile.rb:278:in `from_ruby'
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/gems/cocoapods-core-1.3.1/lib/cocoapods-core/podfile.rb:252:in `from_file'
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/gems/cocoapods-1.3.1/lib/cocoapods/config.rb:191:in `podfile'
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:148:in `verify_podfile_exists!'
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/gems/cocoapods-1.3.1/lib/cocoapods/command/install.rb:37:in `run'
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in `run'
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/gems/cocoapods-1.3.1/bin/pod:55:in `<top (required)>'
/Users/jinyu/.rvm/rubies/ruby-2.2.2/bin/pod:23:in `load'
/Users/jinyu/.rvm/rubies/ruby-2.2.2/bin/pod:23:in `<main>'
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/bin/ruby_executable_hooks:15:in `eval'
/Users/jinyu/.rvm/gems/ruby-2.2.2@global/bin/ruby_executable_hooks:15:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=invalid+byte+sequence+in+UTF-8&type=Issues

If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...

and 14 more at:
https://github.com/cocoapods/cocoapods/search?q=invalid%20byte%20sequence%20in%20UTF-8&type=Issues&utf8=
localhost:ceshi1127 jinyu$ locale
LANG="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_CTYPE="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_ALL=

解决方案

看到这个报错信息,基本可以确定是Podfile中的内容编码有问题,但是我手动修改并没有什么用,在网上搜寻了很久都没有发现怎么解决,差点准备弃用CocoaPods的时候偶然发现打开Podfile文件的另一种方式,用Xcode打开:

[ruby] view plain copy
在CODE上查看代码片派生到我的代码片

open -a XCode Podfile  

(哎,好蠢,其实还可以右键选择打开方式,但是总是双击用默认的文本编辑器打开,才导致了这些问题。所以建议Podfile文件还使用代码编辑器打开吧)

之后再修改Podfile文件时就不会导致编码错误的问题了。

其实就是打开编辑框的问题

相关文章

网友评论

      本文标题:cocoapods 报错解决方案

      本文链接:https://www.haomeiwen.com/subject/gxcdbxtx.html