LoginSignup
8
8

More than 5 years have passed since last update.

(Gem::LoadError)が出たのでbundle updateしました

Last updated at Posted at 2015-04-19

Rails generateコマンドを実行したところ(Gem::LoadError)が出ました。

(Gem::LoadError)が発生

rails g modelを実行したところspringというgemで(Gem::LoadError)がでました。

railsコマンドでエラー
bundle exec rails g model user provider:string uid:string nickname:string image_url:string 

/home/vagrant/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.8.2/lib/bundler/runtime.rb:34:in `block in setup': You have already activated spring 1.3.3, but your Gemfile requires spring 1.3.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)

エラーメッセージでは bundle exec をつければ直るかもと書いてありますが、コマンドはそもそも bundle exec をつけて実行しています。

bundle update をする

おそらくRailsのGemfile.lockは spring (1.3.2) と書いてあるのにも拘らず、入っているspringが1.3.3なのかなと思いました。

springのバージョンを上げる
bundle update

bundle update をすればGemfile.lockのspringのバージョンが上がるのかなと思い実行しました。

Gemfile.lockのspringのバージョンが更新される
spring (1.3.4)

spring1.3.3で良かったのですが1.3.4になってしまいました。

再度rails generateコマンドを実行

rails g を再び実行します。

railsコマンドでモデルを作成
bundle exec rails g model user provider:string uid:string nickname:string image_url:string 

      create    db/migrate/20150419035119_create_users.rb
      create    app/models/user.rb
      invoke    rspec
      create      spec/models/user_spec.rb
      invoke      factory_girl

今度はうまくいきました(☝ ՞ਊ ՞)

8
8
2

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