3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RailsチュートリアルとRails6

Last updated at Posted at 2020-02-12

概要

Railsチュートリアルの指定バージョンが5.1.6なのだが、Rails6でチュートリアルを進めるとエラーが頻出するのでメモ。

*以下「Railsチュートリアル」は「チュートリアル」と表記する。

エラー①

パソコンのRailsのバージョンが6なのにチュートリアルのGemfile通りに

Gemfile
gem 'rails',        '5.1.6'

に指定していると

`load_defaults’: Unknown version “6.0”

こんなメッセージで怒られる。

対処

一度ファイルを削除して、バージョンを指定してrails newするかgemのバージョンを変更する。

エラー②(Rails5も共通?)

Railsチュートリアル1章リスト1.13の通りに指定してbundleするとエラーが出る。

An error occurred while installing sqlite3 (1.3.13), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.13' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  sqlite3

対処

こちらの回答によると

rails6ではsqlite3のgemは1.4以上が必要になる

ということなので

 gem 'sqlite3', '1.3.13'

を下記の内容に書き換え。


gem 'sqlite3', '~> 1.4'

このエラーについては、

gem 'sqlite3', '~> 1.3.13'

のようにすれば良いという記事もあったのだが、Rails5でチュートリアルを進めている時にも同様のエラーが発生した。
こちらも1.4に指定することで解決した。

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?