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>'
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>'
以下命令对我有效:
sudo gem uninstall cocoapods
sudo gem install -n /usr/local/bin cocoapods
cocoapods pod install
如果在第2步遇到以下错误:
ERROR: While executing gem ... (Gem::CommandLineError) Please specify at least one gem name (e.g. gem build GEMNAME)
请使用以下内容代替第2步(无需执行第3步):
gem install -n /usr/local/bin cocoapods
cocoapods
。 - Sanesudo gem install -n /usr/local/bin cocoapods
对我来说可以成功安装cocoapods。 - Cons Bulaquena重新安装 Cocoapods:
brew reinstall cocoapods
如果您在使用 brew reinstall
重新安装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
解决冲突文件:
brew link --overwrite cocoapods
链接 /usr/local/Cellar/cocoapods/1.3.1... 创建了 2 个符号链接
$(inherited)
标志,或者在我的情况下,什么都没有帮助,然后我做了以下几步:
sudo gem uninstall cocoapods
cd /Users/nikkov/.rvm/rubies/ruby-2.4.1/lib/ruby
; 在Finder中搜索 cocoapods
并删除所有内容。brew install cocoapods
brew link --overwrite cocoapods
(如有需要)我已将我的 Ruby 版本从 2.5.3 升级到了 2.7.2。然后,我想将 Cocoapods 从 1.9.3 更新到 1.10.0。但在执行 pod install
时出现了以下错误:
can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
有两种方法可以使用 homebrew 和 gem 卸载 Cocoapods。如果您是使用 gem 安装的 Cocoapods,请运行以下命令进行卸载。
sudo gem uninstall cocoapods
sudo gem uninstall -n /usr/local/bin cocoapods
brew uninstall cocoapods
如果您忘记了之前使用的是哪个,请执行两个命令。请确保删除所有cocoapods实例以检查运行pod --version
。
如果您发现输出为-bash:pod:command not found
,则所有实例都已正确删除。否则,您可能需要手动从此目录~/.rvm/rubies/ruby-2.5.3/lib/ruby中删除与cocoapods相关的文件。
sudo gem update --system
gem install cocoapods
来源:https://blog.csdn.net/develop_csdn/article/details/105053383
sudo gem update --system
对我很有帮助。运行后,问题得到解决。谢谢,Milan。 - natterstefansudo gem update --system
破坏了我所有文件的权限。无法安装任何其他 gem 包。 - Haidar Zeineddine$ brew install rbenv
$ rbenv --version
安装Xcode的命令行工具
xcode-select --install
brew update
brew install rbenv ruby-build
eval "$(rbenv init -)"
rbenv install 3.1.1
rbenv global 3.1.1
rbenv rehash
source ~/.bash_profile
gem install cocoapods
rbenv
版本,我必须输入rbenv --version
。 - Lance SamariaGemfile
文件。当我删除该文件时,CocoaPods就像平常一样正常工作了。请尝试执行sudo gem update
sudo gem install
而不是 gem install
。 - atulkhatri当我尝试使用@Aamir的解决方案时,我遇到了以下错误:
错误: 找不到有效的gem 'cocoapods'(>= 0),原因如下: 无法从https://rubygems.org/下载数据 - 没有这个名称(https://api.rubygems.org/specs.4.8.gz)
这对我的Mac有效:
sudo gem uninstall cocoapods
sudo gem install cocoapods
rvm reset
。rvm reset
rvm --version
sudo gem install -n /usr/local/bin cocoapods
来自这里
bundle install
。 - Dave