Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails console can't find Rake, but Bundler installed it

Rake 12.3.1 is in the Gemfile, and installed:

/app # bundle install | grep rake
Using rake 12.3.1

/app # grep rake Gemfile.lock
      rake (>= 0.8.7)
    rake (12.3.1)

/app # bundle exec gem list | grep rake
rake (12.3.1)

Bundler thinks all is well:

/app # bundle check
The Gemfile's dependencies are satisfied

A plain bundle exec ruby loads it ok:

/app # bundle exec ruby -e'require "rake"; p Rake::VERSION'
"12.3.1"

But, a Rails console can't find it:

/app # bin/rails c
Could not find rake-12.3.1 in any of the sources
Run `bundle install` to install missing gems.

/app # bundle exec bin/rails c
Could not find rake-12.3.1 in any of the sources
Run `bundle install` to install missing gems.

What am I missing?

like image 777
Michael Gee Avatar asked Apr 06 '18 02:04

Michael Gee


1 Answers

Is Spring initialized in your version of rails? If so, try disabling the Spring rails application preloader:

DISABLE_SPRING=true rails c
like image 137
johnsampson Avatar answered Oct 13 '22 06:10

johnsampson