LoginSignup
7
8

More than 5 years have passed since last update.

rake db:create ができない時の対処(Could not find rake-11.2.2 in any of the sources)

Posted at

環境はosx yosemite 10.10.5
ruby -v 2.1.3

自分の場合は
rake db:createをしようとした時に、

Could not find rake-11.2.2 in any of the sources
Run `bundle install` to install missing gems.

このようなエラーが吐かれ、rakeコマンドが使えなくなった。
当然、rake routesrake db:migrateもできない。

rubyの確認

MacBook-Pro-3:app user_name$  which ruby
/Users/user_name/.rbenv/shims/ruby

bundleの確認

ここで、本来ならば、bundleもrakeも.rbenv配下を見て欲しいのだが、

MacBook-Pro-3:app user_name$ which bundle
/usr/bin/bundle
MacBook-Pro-3:app user_name$ bundle show rake
/Library/Ruby/Gems/2.0.0/gems/rake-11.2.2

両方とも.rbenv配下を見に行ってない。

修正作業  bundleのインストール

MacBook-Pro-3:app user_name$ rbenv exec gem install bundler
Successfully installed bundler-1.12.5
Parsing documentation for bundler-1.12.5
Done installing documentation for bundler after 2 seconds
1 gem installed

MacBook-Pro-3:app user_name$ rbenv rehash
MacBook-Pro-3:app user_name$ which bundle
/Users/user_name/.rbenv/shims/bundle

bundleは.rbenv配下に入った。

しかし、
rakeあるはずだけどrakeがない見つからないと言われる・・・。

MacBook-Pro-3:app user_name$ bundle show rake
Could not find rake-11.2.2 in any of the sources

rakeのinstall

MacBook-Pro-3:app user_name$ gem install rake
Fetching: rake-11.2.2.gem (100%)
rake's executable "rake" conflicts with /Users/user_name/.rbenv/versions/2.1.3/bin/rake
Overwrite the executable? [yN]  y
Successfully installed rake-11.2.2
Parsing documentation for rake-11.2.2
Installing ri documentation for rake-11.2.2
Done installing documentation for rake after 0 seconds
1 gem installed

rakeのインストールできた!!!!

bundle install実行

MacBook-Pro-3:app user_name$ bundle install
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Using rake 11.2.2
Installing i18n 0.7.0
Installing json 1.8.3 with native extensions
...
...
...
.
.
.
.
.
Bundle complete! 14 Gemfile dependencies, 69 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

これで晴れてrakeコマンドが使えるようになる。

7
8
0

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