ios cocoapods 没有安装

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37904588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 09:27:38  来源:igfitidea点击:

cocoapods not installing

ioscocoacocoapods

提问by Nirav Hathi

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>'

回答by Aamir

Using following commands, it worked for me.

使用以下命令,它对我有用。

1: sudo gem uninstall cocoapods 

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

3: pod install 

回答by stan liu

If you install cocoapod using brew like me

如果你像我一样使用 brew 安装 cocoapod

  1. Reinstall cocoapods
  1. 重新安装 cocoapods

brew reinstall cocoapods

brew reinstall cocoapods

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

如果您在通过brew reinstall转至步骤 2重新安装 cocoapods 后看到此错误消息。

>
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
  1. 解决冲突文件

brew link --overwrite cocoapods

brew link --overwrite cocoapods

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

Hope it helps.

希望能帮助到你。

回答by x4h1d

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

cocoapods通过以下命令卸载现有的,如果有的话:

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

Then install it to /usr/local/bininstead of /usr/binusing following command:

然后将其安装到/usr/local/bin而不是/usr/bin使用以下命令:

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

For further query, check this linkto uninstall and this linkto install cocoapods.

如需进一步查询,请检查此链接以卸载和此链接以安装 cocoapods。

回答by Nik Kov

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 cocoapodsand removed everything.
  3. brew install cocoapods
  4. brew link --overwrite cocoapods(if needed)
  1. sudo gem uninstall cocoapods
  2. cd /Users/nikkov/.rvm/rubies/ruby-2.4.1/lib/ruby; 在 Finder 中,我搜索cocoapods并删除了所有内容。
  3. brew install cocoapods
  4. brew link --overwrite cocoapods(如果需要的话)

回答by iPC

Try sudo gem update

尝试 sudo gem update

  • After remove cocoapods
  • -Install cocoapods
  • 去除可可豆后
  • - 安装 cocoapods

回答by Ryan Loggerythm

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

当我尝试@Aamir 的解决方案时,我遇到了错误:

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)

错误:找不到有效的 gem 'cocoapods' (>= 0),原因如下:无法从https://rubygems.org/下载数据- 没有这样的名称 ( https://api.rubygems.org/specs .4.8.gz)

This worked for my Mac:

这适用于我的 Mac:

sudo gem uninstall cocoapods
sudo gem install cocoapods

回答by Terry

In my case the reason of the issue was Gemfilefile inside the folder with the project. When I removed this file, cocoapods started functioning as usual.

在我的情况下,问题的原因是Gemfile项目文件夹内的文件。当我删除这个文件时,cocoapods 开始像往常一样运行。