ruby-on-railsrubyrakeoctopress

Problems with migration from older ruby/rbenv


I faced with the following problem: I update my OS X to Yosemite, switched to ruby 2.2.2 and decided to come back to my Octopress-based blog. Below I try to describe all my actions one by one, will be glad if someone tell me where I did something wrong. So I cloned my page from github , checkout to source branch. But when I try to execute any rake command I get error:

rbenv: version `1.9.3-p194' is not installed
rbenv: version `1.9.3-p194' is not installed

I did:

> rbenv local --unset
> rake reharsh --trace
rake aborted!
LoadError: cannot load such file -- bundler/setup
MYPATH/Rakefile:2:in `<top (required)>'

Thus I install bundler:

> gem install bundler
> bundle install
Fetching gem metadata from http://rubygems.org/...........
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Installing rake 0.9.2.2
etc

Finally:

> rake generate --trace
rake aborted!
Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 0.9.2.2. Prepending `bundle exec` to your command may solve this.

UPD: Following advices of K M Rakibul Islam, I changed in the gemfile rake version from 0.9.2 to 10.4 and added line gem 'iconv' to the gem file. After that rake generate start working.


Solution

  • As the error message suggests, you should run the rake command using bundle exec in order to run it in the context of your Gemfile:

    bundle exec rake generate --trace
    

    This should fix your issue.

    Update

    change this: gem 'rake', '~> 0.9.2' to gem 'rake', '~> 10.4.2' in your Gemfile and run: bundle install.