cocoapods not installing

半腔热情 提交于 2019-11-26 19:11:24

问题


What does it mean and how can I fix it:

pod install
/Library/Ruby/Site/2.0.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.0.0/rubygems.rb:278:in `activate_bin_path'
from /usr/local/bin/pod:22:in `<main>'

回答1:


Using following commands, it worked for me.

1: sudo gem uninstall cocoapods 

2: sudo gem install -n /usr/local/bin cocoapods

3: pod install 



回答2:


If you install cocoapod using brew like me

  1. Reinstall cocoapods

brew reinstall cocoapods

If you see this error message after you reinstall cocoapods by brew reinstall go to step 2.

>
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/pod
Target /usr/local/bin/pod
already exists. You may want to remove it:
  rm '/usr/local/bin/pod'

To force the link and overwrite all conflicting files:
  brew link --overwrite cocoapods

To list all files that would be deleted:
  brew link --overwrite --dry-run cocoapods

Possible conflicting files are:
/usr/local/bin/pod
/usr/local/bin/xcodeproj
  1. To solve conflicting files

brew link --overwrite cocoapods

> Linking /usr/local/Cellar/cocoapods/1.3.1... 2 symlinks created

Hope it helps.




回答3:


Uninstall the existing cocoapods, if any, by following command:

gem list --local | grep cocoapods | awk '{print $1}' | xargs sudo gem uninstall

Then install it to /usr/local/bin instead of /usr/bin using following command:

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

For further query, check this link to uninstall and this link to install cocoapods.




回答4:


Try sudo gem update

  • After remove cocoapods
  • -Install cocoapods



回答5:


In my case nothing helped, then I:

  1. sudo gem uninstall cocoapods
  2. cd /Users/nikkov/.rvm/rubies/ruby-2.4.1/lib/ruby; In Finder I searched for cocoapods and removed everything.
  3. brew install cocoapods
  4. brew link --overwrite cocoapods (if needed)



回答6:


When I tried @Aamir's solution, I ran into the error:

ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why: Unable to download data from https://rubygems.org/ - no such name (https://api.rubygems.org/specs.4.8.gz)

This worked for my Mac:

sudo gem uninstall cocoapods
sudo gem install cocoapods


来源:https://stackoverflow.com/questions/37904588/cocoapods-not-installing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!