7
4

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 Tutorial (v.5.1) ハマりポイント 1章 1.3.1項

Last updated at Posted at 2017-11-16

#この記事はなに
Rails Tutorial (v.5.1) をテキスト通りに進めていた中で、ハマったところの対処メモです。2017.11.16時点。
開発環境はcloud9。
今チュートリアルをやっているくらいなので、Rails初心者です。

#1.3.1 Bundler
##先に結論
bundle update 大事。
##ハマったポイント
Gemfileを指示通りに修正し、bundle install したところ、以下のエラーが発生。

console
user:~/workspace/hello_app (master) $ bundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
You have requested:
  listen = 3.0.8

The bundle currently has listen locked at 3.1.5.
Try running `bundle update listen`

If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`

listen locked at 3.1.5 と記載されているので、それに従ってGemfileを修正。

Gemfile
  gem 'listen', '3.1.5'

そして、再度 bundle install実行。

console
user:~/workspace/hello_app (master) $ bundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "activesupport":
  In snapshot (Gemfile.lock):
    activesupport (= 5.1.4)

  In Gemfile:
    rails (= 5.1.2) was resolved to 5.1.2, which depends on
      activesupport (= 5.1.2)

    coffee-rails (= 4.2.2) was resolved to 4.2.2, which depends on
      railties (>= 4.0.0) was resolved to 5.1.4, which depends on
        activesupport (= 5.1.4)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

listenに関するエラーはなくなりましたが、activesupportとrailtiesのバージョンが、依存関係でエラーに。
ここもGemfileを直します、、、と思いましたが、依存関係がコンフリクトしてますね。
rails 5.1.2 -> active support 5.1.2
coffee-rails 4.2.2 -> railties 5.1.4 -> active support 5.1.4

どっちのactivesupportを使えばいいんだ。

よく見ると、エラーメッセージに Running bundle update (中略) may resolve the conflict. と書いてあります。

実際に試したところ、うまく解決できました。

console
user:~/workspace/hello_app (master) $ bundle update
(中略)
Bundle updated!
user:~/workspace/hello_app (master) $ bundle install
(中略)
Bundle complete! 16 Gemfile dependencies, 70 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
7
4
1

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
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?