medright
medright

Reputation: 124

Migrating database fails after upgrading to Ruby 2.3.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!

Upvotes: 0

Views: 365

Answers (1)

Simone Carletti
Simone Carletti

Reputation: 176392

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.

Upvotes: 1

Related Questions