ruby rakeコマンド実行時に「Gem::LoadError: You have already activated rake xx.xx.xx, but your Gemfile requires rake xx.xx.xx. Prepending bundle exec to your command may solve this」が発生した場合の対処法

rakeコマンド実行時にエラー「Gem::LoadError: You have already activated rake xx.xx.xx, but your Gemfile requires rake xx.xx.xx. Prepending bundle exec
to your command may solve this」が発生して実行できないときの対処法を記述してます。
環境
- OS windows10 pro 64bit
- ruby 2.6.6
- gem 3.0.3
エラー全文
「rake preview」実行時に発生
1 2 3 4 |
rake aborted! Gem::LoadError: You have already activated rake 13.0.1, but your Gemfile requires rake 10.5.0. Prepending `bundle exec` to your command may solve this. C:/octopress/Rakefile:2:in `<top (required)>' (See full trace by running task with --trace) |
対処法
エラーに書いてある通り、bundle execを付けて実行すれば解消されます。
1 |
bundle exec rake preview |
ちなみに、各バージョンを確認してみると
1 2 3 4 |
rake -V <出力結果> rake, version 13.0.1 |
bundle execだと
1 2 3 4 |
bundle exec rake --version <出力結果> rake, version 10.5.0 |
となってます。
-
前の記事
CentOs8 KumbiaPHPをインストールして実行する 2020.07.20
-
次の記事
OpenSUSE 15.1から15.2にアップデートする手順 2020.07.20
コメントを書く