LoginSignup
10
3

More than 1 year has passed since last update.

Ruby 2.5.0コンテナでRails6の開発環境を作るときのトラブルシューティング

Posted at

こちらのハンズオンをやっていたところ、いくつかの問題に遭遇したので備忘録。

Rails アプリケーションをコンテナで開発しよう ! 第 1 回 - まずは Rails アプリケーション作りから

Rails7のインストールに失敗する

記事では Ruby2.5 & Rails6 を使用しているが、現時点(2022/1)での最新版は 7.0.1
エラーメッセージにもあるように7.0.1 ではRuby2.7以上が必要であるため gem install railsに失敗する。

root@810c33297af8:/work# gem install rails
Fetching: concurrent-ruby-1.1.9.gem (100%)
Successfully installed concurrent-ruby-1.1.9
Fetching: i18n-1.8.11.gem (100%)
Successfully installed i18n-1.8.11
Fetching: tzinfo-2.0.4.gem (100%)
Successfully installed tzinfo-2.0.4
Fetching: activesupport-7.0.1.gem (100%)
ERROR:  Error installing rails:
    There are no versions of activesupport (= 7.0.1) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?
    activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.5.0.

gem install のオプションでRailsのバージョンを指定してインストールすることとした。

root@810c33297af8:/work# gem install -v 6.0.3.2 rails

Nokogiriのインストールに失敗する

さて、Railのバージョン指定をして改めてgem installを実施したところ、

root@810c33297af8:/work# gem install -v 6.0.3.2 rails
...
Fetching: activesupport-6.0.3.2.gem (100%)
Successfully installed activesupport-6.0.3.2
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    bad response Forbidden 403 (https://api.rubygems.org/quick/Marshal.4.8/nokogiri-1.13.0-x64-unknown.gemspec.rz)

Nokogiri 1.13.0のインストールに失敗している。
403なのでライブラリが不足している的なやつではないみたい。

rubygems.org でNokogiriの過去バージョンを調べて 1.12.5 を予めインストールすることで解決。

root@810c33297af8:/work# gem install nokogiri -v 1.12.5
Fetching: nokogiri-1.12.5-x86_64-linux.gem (100%)
Successfully installed nokogiri-1.12.5-x86_64-linux
1 gem installed
root@810c33297af8:/work# gem install -v 6.0.3.2 rails
Fetching: loofah-2.13.0.gem (100%)
Successfully installed loofah-2.13.0
Fetching: rails-html-sanitizer-1.4.2.gem (100%)
Successfully installed rails-html-sanitizer-1.4.2
Fetching: rails-dom-testing-2.0.3.gem (100%)
Successfully installed rails-dom-testing-2.0.3
Fetching: builder-3.2.4.gem (100%)
Successfully installed builder-3.2.4
Fetching: erubi-1.10.0.gem (100%)
Successfully installed erubi-1.10.0
Fetching: actionview-6.0.3.2.gem (100%)
Successfully installed actionview-6.0.3.2
Fetching: actionpack-6.0.3.2.gem (100%)
Successfully installed actionpack-6.0.3.2
Fetching: activemodel-6.0.3.2.gem (100%)
Successfully installed activemodel-6.0.3.2
Fetching: activerecord-6.0.3.2.gem (100%)
Successfully installed activerecord-6.0.3.2
Fetching: globalid-1.0.0.gem (100%)
Successfully installed globalid-1.0.0
Fetching: activejob-6.0.3.2.gem (100%)
Successfully installed activejob-6.0.3.2
Fetching: mini_mime-1.1.2.gem (100%)
Successfully installed mini_mime-1.1.2
Fetching: mail-2.7.1.gem (100%)
Successfully installed mail-2.7.1
Fetching: actionmailer-6.0.3.2.gem (100%)
Successfully installed actionmailer-6.0.3.2
Fetching: nio4r-2.5.8.gem (100%)
Building native extensions. This could take a while...
Successfully installed nio4r-2.5.8
Fetching: websocket-extensions-0.1.5.gem (100%)
Successfully installed websocket-extensions-0.1.5
Fetching: websocket-driver-0.7.5.gem (100%)
Building native extensions. This could take a while...
Successfully installed websocket-driver-0.7.5
Fetching: actioncable-6.0.3.2.gem (100%)
Successfully installed actioncable-6.0.3.2
Fetching: mimemagic-0.3.10.gem (100%)
Building native extensions. This could take a while...
Successfully installed mimemagic-0.3.10
Fetching: marcel-0.3.3.gem (100%)
Successfully installed marcel-0.3.3
Fetching: activestorage-6.0.3.2.gem (100%)
Successfully installed activestorage-6.0.3.2
Fetching: actionmailbox-6.0.3.2.gem (100%)
Successfully installed actionmailbox-6.0.3.2
Fetching: actiontext-6.0.3.2.gem (100%)
Successfully installed actiontext-6.0.3.2
Fetching: thor-1.2.1.gem (100%)
Successfully installed thor-1.2.1
Fetching: method_source-1.0.0.gem (100%)
Successfully installed method_source-1.0.0
Fetching: railties-6.0.3.2.gem (100%)
Successfully installed railties-6.0.3.2
Fetching: sprockets-4.0.2.gem (100%)
Successfully installed sprockets-4.0.2
Fetching: sprockets-rails-3.4.2.gem (100%)
Successfully installed sprockets-rails-3.4.2
Fetching: rails-6.0.3.2.gem (100%)
Successfully installed rails-6.0.3.2
29 gems installed
10
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
3