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.
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.
Related
Whenever I try to deploy my system the following error occurs:
root#:/var/www/code# bundle exec rake assets:precompile db:migrate RAILS_ENV=production
rake aborted!
LoadError: incompatible library version - /var/www/code/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.8/lib/nokogiri/nokogiri.so
/var/www/code/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.8/lib/nokogiri.rb:32:in `require'
I tried to make an update on all gems:
gem update
And I followed the "Incompatible library version on Ubuntu 16.04" issue, but yet it doesn't work.
Why does this happen?
I circled the uninstallation and installation code at the root of the project:
root#:/var/www/code# gem uninstall nokogiri
And then:
root#:/var/www/code# gem install nokogiri
My gem list shows:
root#:/var/www/code# gem list
- nokogiri (1.7.1)
But when I try to compile it appears again:
/code/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.8/lib/nokogiri/nokogiri.so
Should I accomplish this within the gems/ folder?
I'm having a strange rake error when I try to install, here is what it says
$ rake bundle_install
/usr/local/bin/rake:23:in `load': cannot load such file -- /usr/share/rubygems-integration/1.9.1/gems/rake-10.0.4/bin/rake (LoadError)
from /usr/local/bin/rake:23:in `<main>'
When I try to navigate to the directory, i find nothing:
$ ls /usr/share/rubygems-integration/1.9.1/
specifications/
Ruby versions:
$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
Why it's trying to load the wrong version and how I could fix this?
you can try:
bundle update rake
the same issue was resolved here: Ruby rake loaderror - bundle exec rake not working
Look for the gemspec file.
Your version of rake specified at the gemspec file must match the rake version you are using.
Try: bundle update rake. This will install a new version of rake. Open your gemspec file and update the rake version.
I had this:
spec.add_development_dependency "rake", "~> 10.0"
And I have changed to:
spec.add_development_dependency "rake", "~> 11.0"
run bundle update rake again:
Resolving dependencies...
Using rake 11.3.0 (was 10.5.0)
After that, it will work.
It seems that you need to re-install ruby..Hopefully that might solve the problem.Had faced this issue previously.Resolved by reinstalling ruby.
Perhaps it helps somebody. I had same error, but with rails, instead of rake.
I have got such error while installing redmine.
$ sudo bundle exec rails server webrick -e production
bundler: failed to load command: rails (/usr/local/bin/rails)
LoadError: cannot load such file -- /usr/share/rubygems-integration/all/specifications/bin/rails
/usr/local/bin/rails:23:in `load'
/usr/local/bin/rails:23:in `<top (required)>'
This is my solution:
$ sudo bundle update rails
This should work in the latest version.
# Rakefile.rb
require 'bugsnag/integrations/rake'
I'm trying to deploy my project to a server via capistrano but I get below error and the deployment process fails to proceed:
** [out :: myprojet..] Could not find rake-0.8.7 in any of the sources
** [out :: myprojet..] Run `bundle install` to install missing gems.
I'm using rvm, however I removed rake and manually installed it.. also removed my Gemfile.lock and added gem rake, '0.8.7' to my Gemfile; also didn't worked.
I have the rake in my gem list:
$ gem list | grep rake
rake (0.8.7)
I also added set :rake, 'bundle exec rake' to deploy.rb file but I still get this error. Any idea? tnx.
Before deploy, try this
Remove all the versions of Rake ==> gem uninstall rake
Remove your gemfile.lock => rm Gemfile.lock
Remove gem 'rake' on your Gemfile
Run bundle install
Install Rake manually : gem install rake --version=10.0.4
Problem solved by specifying the rvm Gemset in deploy.rb file:
set :rvm_ruby_string, "ruby-1.9.2-p180#myproject"
set :rvm_type, :user
I begin with ruby on rails and I'm trying to create my first blog. So i ran:
rails new blog -database=mysql
There was an error:
Gem::InstallError: The 'json' native gem requires installed build tools.
But since i saw a json directory in my blog's directory i didn't care.
So i run the command to create the database:
rake db:create --trace
And i had another error:
Could not find gem 'rails (= 3.1.3) x86-mingw32' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
Does anybody knows what is the problem?
Also may need to run
bundle exec rake db:create
you can try "gem list | grep json" to check if json is already install.
Then, you can add following line in Gemfile (in your site's directory):
gem 'json'
and then
bundle install json or bundle update json
Good luck,
I'm trying to run rails project,
I get
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
If I do: "bundle install"
but
I'm getting
You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7
while doing
rake db:migrate
First, check to make sure that rake is mentioned in your Gemfile. If it's not, add it, and specify the version "you already activated".
Then, you'll need to tell bundle to update the rake version it's using for your app:
bundle update rake
It'll update your Gemfile.lock for you.
Where you are currently using rake commands like
rake db:migrate
Use this instead:
bundle exec rake db:migrate
this will be the case until the latest version of rails and/or rake work well together.
I thank to Dobry Den, cheers dude. but little more I had to do.
here is solution (works for me).
I had added
gem 'rake','0.8.7'
on Gemfile, which was not there, but my new version of rails automatically install rake(0.9.0).
after I had delete rake0.9.0 by gem uninstall rake
and after doing bundle update rake , I can create and migrate database.
Rake 0.9.0 breaks rails.
See here: Rake 0.9.0 'undefined method 'task' '
Use bundle exec rake instead of rake to run rake at the correct version.
Specify the version that you want in your Gemfile.
gem 'rake', '0.9.0'
then
bundle update rake
you need to use bundle exec to run your rake task
bundle exec rake db:migrate
Oh look, it's the future. For me, it was complaining I had rake 10.x installed when it wanted 0.9.5. Not quite sure, not familiar enough with Ruby to really dig into what happened to the recent version numbers, but what I did was:
gem uninstall rake
gem install rake -v 0.9.5
to force the system to install the version of rake that the app wanted (for me it was Octopress).
I had this problem (with another gem that was not rake) and I was able to fix it by
gem uninstall <complaining gem>
gem install <complaining gem>
bundle install
bundle update
Note that the keyword 'sudo' was not used (ie. sudo bundle install) as that may place your gem into directories where your rails app might not be searching in.
Add this to your Gemfile
# Rake 0.9.0 break Rails.
gem "rake", "!= 0.9.0"
And then uninstall rake-0.9.0
If I understand what you're not asking, you need to open your Gemfile file and change the line...
gem 'rake', '0.8.7'
...to...
gem 'rake', '0.9.0'