Error fetching https://gems.ruby

2018-10-26  本文已影响0人  Mr_Dreams

https://gems.ruby-china.org/ 访问不了

域名改为

https://gems.ruby-china.com/

所以替换 ruby-china 提供镜像,正确的操作是:

$ sudo gem update --system

$ gem sources --remove https://rubygems.org/

$ gem sources --remove https://ruby.taobao.org/       //如果安装了淘宝的镜像

//等有反应之后再敲入以下命令

gem sources -a https://gems.ruby-china.com/

为了验证你的Ruby镜像是并且仅是ruby-china,可以用以下命令查看:

$ gem sources -l

*** CURRENT SOURCES ***

https://gems.ruby-china.com

You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory

因pod损坏,重安装cocoapods:

在执行命令:

gem update --system

提示如下错误:

Updating rubygems-update

ERROR:  While executing gem ... (Gem::FilePermissionError)

    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

原因是没有权限:

---------------------

近来,升级了mac系统之后,便引发了pod使用异常影响。标题报错即是,昨日在pod一个react-native组件时出现的。

下面简单说一下解决方案,有问题,请留言,必定帮你解决。废话不多说,开始上方案。

一下所有命令均在终端中执行。

1.报错信息:

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

解决方案:

1、更新gem:sudo gem update —system

执行此步报错信息:

ERROR:  While executing gem … (Errno::EPERM)

    Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem

解决方案:

sudo gem update -n /usr/local/bin —system

2、删除gem源:gem sources —remove https://ruby.taobao.org/

3、修改gem源:gem sources -a https://gems.ruby-china.org

4、查看gem源是否是最新的:gem sources -l

5、升级cocoapods:sudo gem install -n /usr/local/bin cocoapods —pre

6、查看升级后的cocoapods版本:pod —version

大功告成!

---------------------

上一篇下一篇

猜你喜欢

热点阅读