Ruby on Rails 基础(6)

2021-11-25 22:24:51 浏览数 (2)

没有创建成功,但是反馈结果却是成功 (说明这是一批命令,最后一个反馈结果正常),并且生成一个文件目录

从输出可以看到 Gem::RemoteFetcher::FetchError: Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/gems/rake-11.1.2.gem)

原因是 bundle 过程中与 gem 安装源连接产生了问题

解决办法是替换成稳定可用且可达的源

代码语言:javascript复制
[root@h202 ruby]# ls
blog
[root@h202 ruby]# cd blog/
[root@h202 blog]# ls
app  bin  config  config.ru  db  Gemfile  lib  log  public  Rakefile  README.rdoc  test  tmp  vendor
[root@h202 blog]# head -n 3 Gemfile 
source 'https://rubygems.org'


[root@h202 blog]# vim Gemfile 
[root@h202 blog]# head -n 3 Gemfile
#source 'https://rubygems.org'
source 'https://gems.ruby-china.org/'

[root@h202 blog]# 

根据提示再次尝试安装

代码语言:javascript复制
[root@h202 blog]# gem install rake -v '11.1.2'
Fetching: rake-11.1.2.gem (100%)
Successfully installed rake-11.1.2
Parsing documentation for rake-11.1.2
Installing ri documentation for rake-11.1.2
Done installing documentation for rake after 1 seconds
1 gem installed
[root@h202 blog]# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application
for all non-root users on this machine.
Fetching gem metadata from https://gems.ruby-china.org/...........
Fetching version metadata from https://gems.ruby-china.org/...
Fetching dependency metadata from https://gems.ruby-china.org/..
Resolving dependencies..........
Using rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Installing minitest 5.8.4
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4
Using mime-types-data 3.2016.0221
Using arel 6.0.3
Installing debug_inspector 0.0.2 with native extensions
Using bundler 1.11.2
Installing byebug 8.2.4 with native extensions
Installing coffee-script-source 1.10.0
Installing execjs 2.6.0
Using thor 0.19.1
Using concurrent-ruby 1.0.1
Installing multi_json 1.11.2
Installing sass 3.4.22
Installing tilt 2.0.2
Installing spring 1.7.1
Installing sqlite3 1.3.11 with native extensions
Installing rdoc 4.2.2
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using mime-types 3.0
Installing binding_of_caller 0.7.2 with native extensions
Installing coffee-script 2.4.1
Installing uglifier 3.0.0
Using sprockets 3.6.0
Installing sdoc 0.4.1
Using activesupport 4.2.6
Using loofah 2.0.3
Using mail 2.6.4
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.3.6
Using activemodel 4.2.6
Installing jbuilder 2.4.1
Using rails-html-sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using activejob 4.2.6
Using activerecord 4.2.6
Using actionview 4.2.6
Using actionpack 4.2.6
Using actionmailer 4.2.6
Using railties 4.2.6
Using sprockets-rails 3.0.4
Installing coffee-rails 4.1.1
Installing jquery-rails 4.1.1
Using rails 4.2.6
Installing sass-rails 5.0.4
Installing web-console 2.3.0
Installing turbolinks 2.5.3
Bundle complete! 12 Gemfile dependencies, 55 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
[root@h202 blog]# echo $?
0
[root@h202 blog]# 

0 人点赞