无法使用cocoapods解决方式

2018-01-22  本文已影响0人  Michael_杰

初始化pod文件失败

$ pod init

-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

重新下载cocoapods失败

$sudo gem install cocoapods

Fetching: concurrent-ruby-1.0.5.gem (100%)
Successfully installed concurrent-ruby-1.0.5
Fetching: i18n-0.9.1.gem (100%)
Successfully installed i18n-0.9.1
Fetching: thread_safe-0.3.6.gem (100%)
Successfully installed thread_safe-0.3.6
Fetching: tzinfo-1.2.4.gem (100%)
Successfully installed tzinfo-1.2.4
Fetching: activesupport-4.2.10.gem (100%)
Successfully installed activesupport-4.2.10
Fetching: nap-1.1.0.gem (100%)
Successfully installed nap-1.1.0
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
Fetching: cocoapods-core-1.4.0.gem (100%)
Successfully installed cocoapods-core-1.4.0
Fetching: claide-1.0.2.gem (100%)
Successfully installed claide-1.0.2
Fetching: cocoapods-deintegrate-1.0.2.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.2
Fetching: cocoapods-downloader-1.1.3.gem (100%)
Successfully installed cocoapods-downloader-1.1.3
Fetching: cocoapods-plugins-1.0.0.gem (100%)
Successfully installed cocoapods-plugins-1.0.0
Fetching: cocoapods-search-1.0.0.gem (100%)
Successfully installed cocoapods-search-1.0.0
Fetching: cocoapods-stats-1.0.0.gem (100%)
Successfully installed cocoapods-stats-1.0.0
Fetching: netrc-0.11.0.gem (100%)
Successfully installed netrc-0.11.0
Fetching: cocoapods-trunk-1.3.0.gem (100%)
Successfully installed cocoapods-trunk-1.3.0
Fetching: cocoapods-try-1.1.0.gem (100%)
Successfully installed cocoapods-try-1.1.0
Fetching: molinillo-0.6.4.gem (100%)
Successfully installed molinillo-0.6.4
Fetching: CFPropertyList-2.3.6.gem (100%)
Successfully installed CFPropertyList-2.3.6
Fetching: colored2-3.1.2.gem (100%)
Successfully installed colored2-3.1.2
Fetching: nanaimo-0.2.3.gem (100%)
Successfully installed nanaimo-0.2.3
Fetching: xcodeproj-1.5.4.gem (100%)
ERROR: While executing gem ... (TypeError)
no implicit conversion of nil into String
me:te JunJie$ sudo gem install -n /usr/local/bin cocoapods --pre
ERROR: While executing gem ... (TypeError)
no implicit conversion of nil into String

查看源

$gem sources -l

*** CURRENT SOURCES ***

添加源

$gem source -a https://gems.ruby-china.org/

https://gems.ruby-china.org/ added to sources

更新gem

$sudo gem update --system

Updating rubygems-update
Fetching: rubygems-update-2.6.14.gem (100%)
Successfully installed rubygems-update-2.6.14
Parsing documentation for rubygems-update-2.6.14
Installing ri documentation for rubygems-update-2.6.14
Installing darkfish documentation for rubygems-update-2.6.14
Done installing documentation for rubygems-update after 43 seconds
Parsing documentation for rubygems-update-2.6.14
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 2.6.14
RubyGems 2.6.14 installed
Parsing documentation for rubygems-2.6.14
Installing ri documentation for rubygems-2.6.14

=== 2.6.14 / 2017-10-09

Security fixes:

=== 2.6.13 / 2017-08-27

Security fixes:

=== 2.6.12 / 2017-04-30

Bug fixes:

=== 2.6.11 / 2017-03-16

Bug fixes:

=== 2.6.10 / 2017-01-23

Bug fixes:

=== 2.6.9 / 2017-01-20

Bug fixes:

=== 2.6.8 / 2016-10-29

Bug fixes:

=== 2.6.7 / 2016-09-26

Bug fixes:

=== 2.6.6 / 2016-06-22

Bug fixes:

=== 2.6.5 / 2016-06-21

Minor enhancements:

Bug fixes:

=== 2.6.4 / 2016-04-26

Minor enhancements:

Bug fixes:

=== 2.6.3 / 2016-04-05

Minor enhancements:

Bug fixes:

=== 2.6.2 / 2016-03-12

Bug fixes:

=== 2.6.1 / 2016-02-28

Bug fixes:

=== 2.6.0 / 2016-02-26

Minor enhancements:

Bug fixes:

=== 2.5.2 / 2016-01-31

Bug fixes:

Minor enhancements:


RubyGems installed the following executables:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem

Ruby Interactive (ri) documentation was installed. ri is kind of like man
pages for ruby libraries. You may access it like this:
ri Classname
ri Classname.class_method
ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.

RubyGems system software updated

卸载cocoapods

$sudo gem uninstall cocoapods

重新安装cocoapods

$ sudo gem install -n /usr/local/bin cocoapods

Successfully installed xcodeproj-1.5.4
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: fourflusher-2.0.1.gem (100%)
Successfully installed fourflusher-2.0.1
Fetching: gh_inspector-1.0.3.gem (100%)
Successfully installed gh_inspector-1.0.3
Fetching: ruby-macho-1.1.0.gem (100%)
Successfully installed ruby-macho-1.1.0
Fetching: cocoapods-1.4.0.gem (100%)
Successfully installed cocoapods-1.4.0
Parsing documentation for xcodeproj-1.5.4
Installing ri documentation for xcodeproj-1.5.4
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for fourflusher-2.0.1
Installing ri documentation for fourflusher-2.0.1
Parsing documentation for gh_inspector-1.0.3
Installing ri documentation for gh_inspector-1.0.3
Parsing documentation for ruby-macho-1.1.0
Installing ri documentation for ruby-macho-1.1.0
Parsing documentation for cocoapods-1.4.0
Installing ri documentation for cocoapods-1.4.0
Done installing documentation for xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 8 seconds
6 gems installed
me:te JunJie$ pod setup
Setting up CocoaPods master repo
$ /usr/bin/git -C /Users/weijunjie/.cocoapods/repos/master fetch origin
--progress
remote: Counting objects: 1001712, done.
remote: Compressing objects: 100% (245/245), done.
Receiving objects: 100% (1001712/1001712), 159.27 MiB | 31.00 KiB/s, done.
remote: Total 1001712 (delta 35411), reused 35301 (delta 35301), pack-reused 966150
Resolving deltas: 100% (663514/663514), completed with 3845 local objects.
From https://github.com/CocoaPods/Specs
83e8a706fb5..15b1c89c5fc master -> origin/master

搞定

$ pod search sdwebimage

SDWebImage (4.2.3)
Asynchronous image downloader with cache support with an UIImageView
category.
pod 'SDWebImage', '~> 4.2.3'

总结:

电脑版本升级后,cocoapods无法使用,淘宝的镜像无法使用,需要设置镜像为gem source -a https://gems.ruby-china.org/,更新gem,卸载cocoapods,在安装cocoapods即可!

上一篇 下一篇

猜你喜欢

热点阅读