質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

コマンド

コマンドとは特定のタスクを行う為に、コンピュータープログラムへ提示する指示文です。多くの場合、コマンドはShellやcmdようなコマンドラインインターフェイスに対する指示文を指します。

Q&A

解決済

2回答

1136閲覧

Railsコマンド入力の際に、bundleバージョンのエラーが返される

Oteppei

総合スコア4

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

コマンド

コマンドとは特定のタスクを行う為に、コンピュータープログラムへ提示する指示文です。多くの場合、コマンドはShellやcmdようなコマンドラインインターフェイスに対する指示文を指します。

0グッド

0クリップ

投稿2020/02/07 06:49

前提・実現したいこと

Ruby on Railsを勉強中であり、現在ローカルに開発環境を構築中。
https://qiita.com/TAByasu/items/47c6cfbeeafad39eda07 の記事を元に
HomebrewからRailsまでダウンロードし、Railsアプリを作成しました。
rails newコマンドは通りましたが、
それ以降のrailsコマンド(g contoroller やserverなど)を入力した際に
全て同じエラーメッセージが返されます。(bundleのバージョンが古いという旨)
そこでbundle -vでバージョンを確認したところ、
2.1.4と返されます。

bundleのアップデートもしましたが、依然変わらず原因がわかりません。
どなたかよろしくお願いします。

発生している問題・エラーメッセージ

Traceback (most recent call last): 5: from bin/rails:3:in `<main>' 4: from bin/rails:3:in `load' 3: from /Users/(ユーザー名)/Desktop/program/rails/progate_sample/tweet_app/bin/spring:10:in `<top (required)>' 2: from /Users/(ユーザー名)/Desktop/program/rails/progate_sample/tweet_app/bin/spring:10:in `new' 1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/lockfile_parser.rb:95:in `initialize' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version': You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)

該当のソースコード

Gemfile

1GEM 2 remote: https://rubygems.org/ 3 specs: 4 actioncable (6.0.2.1) 5 actionpack (= 6.0.2.1) 6 nio4r (~> 2.0) 7 websocket-driver (>= 0.6.1) 8 actionmailbox (6.0.2.1) 9 actionpack (= 6.0.2.1) 10 activejob (= 6.0.2.1) 11 activerecord (= 6.0.2.1) 12 activestorage (= 6.0.2.1) 13 activesupport (= 6.0.2.1) 14 mail (>= 2.7.1) 15 actionmailer (6.0.2.1) 16 actionpack (= 6.0.2.1) 17 actionview (= 6.0.2.1) 18 activejob (= 6.0.2.1) 19 mail (~> 2.5, >= 2.5.4) 20 rails-dom-testing (~> 2.0) 21 actionpack (6.0.2.1) 22 actionview (= 6.0.2.1) 23 activesupport (= 6.0.2.1) 24 rack (~> 2.0, >= 2.0.8) 25 rack-test (>= 0.6.3) 26 rails-dom-testing (~> 2.0) 27 rails-html-sanitizer (~> 1.0, >= 1.2.0) 28 actiontext (6.0.2.1) 29 actionpack (= 6.0.2.1) 30 activerecord (= 6.0.2.1) 31 activestorage (= 6.0.2.1) 32 activesupport (= 6.0.2.1) 33 nokogiri (>= 1.8.5) 34 actionview (6.0.2.1) 35 activesupport (= 6.0.2.1) 36 builder (~> 3.1) 37 erubi (~> 1.4) 38 rails-dom-testing (~> 2.0) 39 rails-html-sanitizer (~> 1.1, >= 1.2.0) 40 activejob (6.0.2.1) 41 activesupport (= 6.0.2.1) 42 globalid (>= 0.3.6) 43 activemodel (6.0.2.1) 44 activesupport (= 6.0.2.1) 45 activerecord (6.0.2.1) 46 activemodel (= 6.0.2.1) 47 activesupport (= 6.0.2.1) 48 activestorage (6.0.2.1) 49 actionpack (= 6.0.2.1) 50 activejob (= 6.0.2.1) 51 activerecord (= 6.0.2.1) 52 marcel (~> 0.3.1) 53 activesupport (6.0.2.1) 54 concurrent-ruby (~> 1.0, >= 1.0.2) 55 i18n (>= 0.7, < 2) 56 minitest (~> 5.1) 57 tzinfo (~> 1.1) 58 zeitwerk (~> 2.2) 59 addressable (2.7.0) 60 public_suffix (>= 2.0.2, < 5.0) 61 bindex (0.8.1) 62 bootsnap (1.4.5) 63 msgpack (~> 1.0) 64 builder (3.2.4) 65 byebug (11.1.1) 66 capybara (3.31.0) 67 addressable 68 mini_mime (>= 0.1.3) 69 nokogiri (~> 1.8) 70 rack (>= 1.6.0) 71 rack-test (>= 0.6.3) 72 regexp_parser (~> 1.5) 73 xpath (~> 3.2) 74 childprocess (3.0.0) 75 concurrent-ruby (1.1.5) 76 crass (1.0.6) 77 erubi (1.9.0) 78 ffi (1.12.2) 79 globalid (0.4.2) 80 activesupport (>= 4.2.0) 81 i18n (1.8.2) 82 concurrent-ruby (~> 1.0) 83 jbuilder (2.9.1) 84 activesupport (>= 4.2.0) 85 listen (3.1.5) 86 rb-fsevent (~> 0.9, >= 0.9.4) 87 rb-inotify (~> 0.9, >= 0.9.7) 88 ruby_dep (~> 1.2) 89 loofah (2.4.0) 90 crass (~> 1.0.2) 91 nokogiri (>= 1.5.9) 92 mail (2.7.1) 93 mini_mime (>= 0.1.1) 94 marcel (0.3.3) 95 mimemagic (~> 0.3.2) 96 method_source (0.9.2) 97 mimemagic (0.3.4) 98 mini_mime (1.0.2) 99 mini_portile2 (2.4.0) 100 minitest (5.14.0) 101 msgpack (1.3.3) 102 nio4r (2.5.2) 103 nokogiri (1.10.7) 104 mini_portile2 (~> 2.4.0) 105 public_suffix (4.0.3) 106 puma (4.3.1) 107 nio4r (~> 2.0) 108 rack (2.1.2) 109 rack-proxy (0.6.5) 110 rack 111 rack-test (1.1.0) 112 rack (>= 1.0, < 3) 113 rails (6.0.2.1) 114 actioncable (= 6.0.2.1) 115 actionmailbox (= 6.0.2.1) 116 actionmailer (= 6.0.2.1) 117 actionpack (= 6.0.2.1) 118 actiontext (= 6.0.2.1) 119 actionview (= 6.0.2.1) 120 activejob (= 6.0.2.1) 121 activemodel (= 6.0.2.1) 122 activerecord (= 6.0.2.1) 123 activestorage (= 6.0.2.1) 124 activesupport (= 6.0.2.1) 125 bundler (>= 1.3.0) 126 railties (= 6.0.2.1) 127 sprockets-rails (>= 2.0.0) 128 rails-dom-testing (2.0.3) 129 activesupport (>= 4.2.0) 130 nokogiri (>= 1.6) 131 rails-html-sanitizer (1.3.0) 132 loofah (~> 2.3) 133 railties (6.0.2.1) 134 actionpack (= 6.0.2.1) 135 activesupport (= 6.0.2.1) 136 method_source 137 rake (>= 0.8.7) 138 thor (>= 0.20.3, < 2.0) 139 rake (13.0.1) 140 rb-fsevent (0.10.3) 141 rb-inotify (0.10.1) 142 ffi (~> 1.0) 143 regexp_parser (1.6.0) 144 ruby_dep (1.5.0) 145 rubyzip (2.2.0) 146 sass-rails (6.0.0) 147 sassc-rails (~> 2.1, >= 2.1.1) 148 sassc (2.2.1) 149 ffi (~> 1.9) 150 sassc-rails (2.1.2) 151 railties (>= 4.0.0) 152 sassc (>= 2.0) 153 sprockets (> 3.0) 154 sprockets-rails 155 tilt 156 selenium-webdriver (3.142.7) 157 childprocess (>= 0.5, < 4.0) 158 rubyzip (>= 1.2.2) 159 spring (2.1.0) 160 spring-watcher-listen (2.0.1) 161 listen (>= 2.7, < 4.0) 162 spring (>= 1.2, < 3.0) 163 sprockets (4.0.0) 164 concurrent-ruby (~> 1.0) 165 rack (> 1, < 3) 166 sprockets-rails (3.2.1) 167 actionpack (>= 4.0) 168 activesupport (>= 4.0) 169 sprockets (>= 3.0.0) 170 sqlite3 (1.4.2) 171 thor (1.0.1) 172 thread_safe (0.3.6) 173 tilt (2.0.10) 174 turbolinks (5.2.1) 175 turbolinks-source (~> 5.2) 176 turbolinks-source (5.2.0) 177 tzinfo (1.2.6) 178 thread_safe (~> 0.1) 179 web-console (4.0.1) 180 actionview (>= 6.0.0) 181 activemodel (>= 6.0.0) 182 bindex (>= 0.4.0) 183 railties (>= 6.0.0) 184 webdrivers (4.2.0) 185 nokogiri (~> 1.6) 186 rubyzip (>= 1.3.0) 187 selenium-webdriver (>= 3.0, < 4.0) 188 webpacker (4.2.2) 189 activesupport (>= 4.2) 190 rack-proxy (>= 0.6.1) 191 railties (>= 4.2) 192 websocket-driver (0.7.1) 193 websocket-extensions (>= 0.1.0) 194 websocket-extensions (0.1.4) 195 xpath (3.2.0) 196 nokogiri (~> 1.8) 197 zeitwerk (2.2.2) 198 199PLATFORMS 200 ruby 201 202DEPENDENCIES 203 bootsnap (>= 1.4.2) 204 byebug 205 capybara (>= 2.15) 206 jbuilder (~> 2.7) 207 listen (>= 3.0.5, < 3.2) 208 puma (~> 4.1) 209 rails (~> 6.0.2, >= 6.0.2.1) 210 sass-rails (>= 6) 211 selenium-webdriver 212 spring 213 spring-watcher-listen (~> 2.0.0) 214 sqlite3 (~> 1.4) 215 turbolinks (~> 5) 216 tzinfo-data 217 web-console (>= 3.3.0) 218 webdrivers 219 webpacker (~> 4.0) 220 221RUBY VERSION 222 ruby 2.6.3p62 223 224BUNDLED WITH 225 2.1.4 226

warn_for_outdated_bundler_version

1def warn_for_outdated_bundler_version 2 return unless bundler_version 3 prerelease_text = bundler_version.prerelease? ? " --pre" : "" 4 current_version = Gem::Version.create(Bundler::VERSION) 5 case current_version.segments.first <=> bundler_version.segments.first 6 when -1 7 raise LockfileError, "You must use Bundler #{bundler_version.segments.first} or greater with this lockfile." 8 when 0 9 if current_version < bundler_version 10 Bundler.ui.warn "Warning: the running version of Bundler (#{current_version}) is older " \ 11 "than the version that created the lockfile (#{bundler_version}). We suggest you " \ 12 "upgrade to the latest version of Bundler by running `gem " \ 13 "install bundler#{prerelease_text}`.\n" 14 end 15 end 16 end

試したこと

Rubyのバージョン変更(2.7.0→2.6.3)
bundle update
アプリケーション内のGemfileの確認

補足情報(FW/ツールのバージョンなど)

Ruby 2.6.3
Rails 6.0.2.1
brew 2.2.5
gem 3.0.3
bundle 2.1.4

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

maisumakun

2020/02/07 06:54

「Rubyのバージョン変更」は、どのようにして行いましたか?
Oteppei

2020/02/07 06:57

ありがとうございます! Rubyのバージョン変更は rbenv install 2.6.3 rbenv global 2.6.3 rbenv rehash で行いました。
guest

回答2

0

You must use Bundler 2 or greater with this lockfile.

こんなことが書いてありました。
Gemfile.lock を削除しても問題ないのであれば、一度 Gemfile.lock を削除して再度 bundle install --path vendor/bundle するのも手の1つではありそうです。

投稿2020/02/09 13:52

siruku6

総合スコア1382

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Oteppei

2020/02/15 15:44

返答が遅れ申し訳ありません。 ご教示いただいた操作を行ってもなお同じエラーが出たため、クリーンインストールし直し再度環境構築を行ったらうまく行きました。 ありがとうございました。
guest

0

自己解決

クリーンインストールをし、再度環境構築を行ったらうまく行きました。
おそらくどこかの箇所で指示以外の操作をしていたようです。

投稿2020/02/15 15:45

Oteppei

総合スコア4

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問