0

I've updated to Ruby 2.3.0 and I'm having some issues when creating a new Rails app. After creating a simple new test app and scaffolding a resource, when trying to execute rake db:migrate I'm getting the following load error:

    MacBook-Pro:log medright1$ rake db:migrate
/Users/medright1/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/rake-10.4.2/bin/rake:31:in `require': cannot load such file -- rake (LoadError)
    from /Users/medright1/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/rake-10.4.2/bin/rake:31:in `<top (required)>'
    from /Users/medright1/.rvm/gems/ruby-2.3.0/bin/rake:23:in `load'
    from /Users/medright1/.rvm/gems/ruby-2.3.0/bin/rake:23:in `<main>'
    from /Users/medright1/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/medright1/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
MacBook-Pro:log medright1$

Any help sorting this would be great!

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
medright
  • 138
  • 10

1 Answers1

1

If you haven't done it yet, make sure you have all the dependencies installed.

$ bundle

or

$ bundle install

It's likely you don't have rake installed in the global RVM gemset. In any case, given you are within a Rails project, you should use bundler to execute the command.

$ bundle exec rake db:migrate

Otherwise, make sure to install rake globally

$ rvm gemset use global
$ gem install rake

However, the correct way is to execute the command via Bundler.

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
  • Thank you very much Simone! The last two commands fixed the issue.. as I had previously had 2.2 versions of ruby installed with rails 4.2.5 apps running rake with no problems did I miss something in the upgrade to 2.3? I'm fairly new to programming and not really sure where I might have gone wrong here.. – medright Jan 05 '16 at 18:52
  • By default, `rake` is not installed in the global gemset (as in general you don't install gems in the global gemset). You may had it in a previous setup for some reason, and you didn't notice it hence you assumed it was the default behavior. – Simone Carletti Jan 05 '16 at 18:53