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
cocoapods not installing
提问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
- Reinstall cocoapods
- 重新安装 cocoapods
brew reinstall cocoapods
brew reinstall cocoapods
If you see this error message after you reinstall cocoapods by brew reinstall
go 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
- To solve conflicting files
- 解决冲突文件
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/bin
instead of /usr/bin
using 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.
回答by Nik Kov
In my case nothing helped, then I:
就我而言,没有任何帮助,然后我:
sudo gem uninstall cocoapods
cd /Users/nikkov/.rvm/rubies/ruby-2.4.1/lib/ruby
; In Finder I searched forcocoapods
and removed everything.brew install cocoapods
brew link --overwrite cocoapods
(if needed)
sudo gem uninstall cocoapods
cd /Users/nikkov/.rvm/rubies/ruby-2.4.1/lib/ruby
; 在 Finder 中,我搜索cocoapods
并删除了所有内容。brew install cocoapods
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 Gemfile
file inside the folder with the project. When I removed this file, cocoapods started functioning as usual.
在我的情况下,问题的原因是Gemfile
项目文件夹内的文件。当我删除这个文件时,cocoapods 开始像往常一样运行。