Any rails command gives noexec.rb:75:in `setup': undefined method `name' - ruby-on-rails-3

First time question here forgive me if I am not descriptive. Running Ruby 1.8.7 w/ rails 2.3.5 If I run any rails or rake task I get
/home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `setup': undefined method `name' for #<Array:0x7f45a2fe73a8> (NoMethodError)
from /home/mathew/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `map'
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `each'
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `map'
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `setup'
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:114:in `check'
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:121
from /home/mathew/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /home/mathew/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems_executable_plugin.rb:4
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:50:in `call'
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:50:in `run'
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:49:in `each'
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:49:in `run'
from /home/mathew/.rvm/gems/ruby-1.8.7-p374#wholesale/bin/ruby_executable_hooks:10
my gem list is:
*** LOCAL GEMS ***
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
atomic (1.1.14)
bcrypt-ruby (3.1.2)
bundler (1.3.5)
bundler-unload (1.0.2)
daemons (1.0.10)
delayed_job (2.0.4)
executable-hooks (1.2.6)
hpricot (0.8.4)
i18n (0.6.5, 0.5.0)
json (1.8.1)
minitest (4.7.5)
multi_json (1.8.2)
mysql (2.8.1)
nokogiri (1.4.1)
rack (1.5.2, 1.0.1)
rails (2.3.5)
rake (10.1.0, 0.9.2.2)
rdoc (4.0.1)
rubygems-bundler (1.4.2)
rubygems-update (2.1.10, 1.8.25)
rvm (1.11.3.8)
thread_safe (0.1.3)
tzinfo (0.3.38)
From what I have read bcrypt-ruby and bundler don't play nice together. So I tried to uninstall bundler and rubygems-bundler (because rubygems-bundler is in the error output) but they don't seem to be uninstalled when I run gem list :/ Any help would be appreciated. Thanks!

Seems duplicated with: Rails 2.3.14 not working and the answer there was: Remove bundle from global gemset
$ rvm #global
$ gem uninstall bundler

For those coming from a search engine: In my case, with rubygems 3.1.1 and bundler 2.1.0, the issue was still having rubygems-bundler installed.
Traceback (most recent call last):
6: from /Users/myuser/.rvm/gems/ruby-2.6.3#timing/bin/ruby_executable_hooks:10:in `<main>'
5: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:49:in `run'
4: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:49:in `each'
3: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:50:in `block in run'
2: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/rubygems-bundler-1.4.5/lib/rubygems_executable_plugin.rb:4:in `block in <top (required)>'
1: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- rubygems-bundler/noexec (LoadError)
10: from /Users/myuser/.rvm/gems/ruby-2.6.3#timing/bin/ruby_executable_hooks:10:in `<main>'
9: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:49:in `run'
8: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:49:in `each'
7: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:50:in `block in run'
6: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/rubygems-bundler-1.4.5/lib/rubygems_executable_plugin.rb:4:in `block in <top (required)>'
5: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:156:in `require'
4: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:168:in `rescue in require'
3: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:168:in `require'
2: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/rubygems-bundler-1.4.5/lib/rubygems-bundler/noexec.rb:131:in `<top (required)>'
1: from /Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/rubygems-bundler-1.4.5/lib/rubygems-bundler/noexec.rb:124:in `check'
/Users/myuser/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/rubygems-bundler-1.4.5/lib/rubygems-bundler/noexec.rb:84:in `setup': undefined method `plain_specs' for #<Bundler::RubygemsIntegration:0x00007f90bf0cb3e8> (NoMethodError)
Looking into the situation, the readme has this to say:
Generally, this gem is not needed on RubyGems >= 2.2.0.
The solution was to remove that gem from the #global gemset:
rvm #global
gem uninstall rubygems-bundler

Related

Rails console uninitialized constant MiniTest::Test (NameError) error

I use Rails. 3.2.16, with Rspec.
Recently when I run rails console I get the following error:
.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/minitest/unit.rb:28:in `const_missing': uninitialized constant MiniTest::Test (NameError)
from .rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/test/unit/testcase.rb:8:in `<module:Unit>'
from .rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/test/unit/testcase.rb:4:in `<module:Test>'
from .rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/test/unit/testcase.rb:3:in `<top (required)>'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/activesupport-3.2.16/lib/active_support/test_case.rb:1:in `<top (required)>'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/console/app.rb:2:in `<top (required)>'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/application.rb:312:in `initialize_console'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/application.rb:152:in `load_console'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/commands/console.rb:27:in `start'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/commands/console.rb:8:in `start'
from .rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-3.2.16/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
When I run rails server there are no problems.
Since I use Rspec, I don't have minitest in my Gemfile. However when I run gem list I can see:
minitest (5.3.3, 5.3.2, 4.7.5, 4.3.2)
And I am not sure why this suddenly happens.
Additional note
#user3364461 may have a related issue:
With RVM and last bundler (1.6.2) ruby 2.1.1, and rails 4.1. Happen
when I've updated some gem (Axlsx-rails, minitest, arel) If I force
minitest 5.3.2, it's the same bug with arel :
Could not find minitest-5.3.3 in any of the sources Run bundle install
to install missing gems.

rake install fails but gem install works fine, any idea why?

The problem:
I have this gem that I am working on. While trying to install it locally to do some tests, rake install fails after building the gem. Rake suggested that I run gem install for the built gem to debug. Surprisingly, gem install pkg/my_gem-x.y.z.gem works like a charm!
Any idea why?
Some details:
rake version: 10.0.3
Gem created using bundler version: 1.2.1
Contents of gemspec:
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'my_gem/version'
Gem::Specification.new do |gem|
gem.name = "mygem"
gem.version = MyGem::VERSION
gem.authors = ["Omar Abdel-Wahab"]
gem.email = ["me#example.com"]
gem.description = %q{bla bla bla}
gem.summary = %q{bla bla bla}
gem.homepage = "http://github.com/foobar/"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
gem.add_dependency "rails", ">= 3.1"
gem.add_dependency "jquery-rails"
gem.add_dependency "twitter-bootstrap-rails", ">= 2.1.0"
gem.add_development_dependency "bundler", ">= 1.0.0"
gem.add_development_dependency "rspec", "~> 2.3"
gem.add_development_dependency "sqlite3-ruby"
end
Output from rake install:
~/Projects/Github/my_gem% rake -vt install
** Invoke install (first_time)
** Execute install
my_gem 0.0.1 built to pkg/my_gem-0.0.1.gem
rake aborted!
Couldn't install gem, run `gem install /Users/owahab/Projects/Github/my_gem/pkg/my_gem-0.0.1.gem' for more detailed output
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.2.1/lib/bundler/gem_helper.rb:68:in `install_gem'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.2.1/lib/bundler/gem_helper.rb:43:in `block in install'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/task.rb:228:in `call'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/task.rb:228:in `block in execute'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/task.rb:223:in `each'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/owahab/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/bin/rake:19:in `load'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/bin/rake:19:in `<main>'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/bin/ruby_noexec_wrapper:14:in `eval'
/Users/owahab/.rvm/gems/ruby-1.9.3-p286/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => install
Output from rake build then gem install:
~/Projects/Github/rails_autocomplete% rake build && gem install pkg/my_gem-0.0.1.gem
my_gem 0.0.1 built to pkg/my_gem-0.0.1.gem
Successfully installed my_gem-0.0.1
1 gem installed
Installing ri documentation for my_gem-0.0.1...
Building YARD (yri) index for my_gem-0.0.1...
Installing RDoc documentation for my_gem-0.0.1...
Based on the comment thread on the question, it was a permission problem. Debugging Bundler's gem_helper.rb file revealed this:
ERROR: While executing gem ... (Errno::EACCES) Permission denied - /Users/owahab/.rvm/gems/ruby-1.9.3-p286/gems/i18n-0.6.1/ci/Gemfile.no-rails
Some gems had been installed as root. Removing them solved the problem.

Ruby on Rails + PostgreSQL app fails to start on AWS EC2. Error is: "cannot load such file -- pg_ext (LoadError)"

I began by installing all these dependencies:
sudo yum install ruby19 ruby19-devel gem rubygems19-devel make gcc postgresql9 postgresql9-devel postgresql9-server
Then I switch to the root user and I run
bundle install
and I get the green success message:
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
However, when I cd to the dir and run
rails s -p80
it I get all this and it fails to start (I'm still root because bind won't work to port 80 if I'm not root):
/usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- pg_ext (LoadError)
from /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/share/gems/gems/pg-0.14.0/lib/pg.rb:4:in `<top (required)>'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `each'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `block in require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `each'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `require'
from /usr/local/share/gems/gems/bundler-1.2.0/lib/bundler.rb:128:in `require'
from /home/user/TransForm/config/application.rb:7:in `<top (required)>'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
from /usr/local/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Perhaps there is an easy way to just deploy it correctly from the begining instead of messing around with error craps? I need PostgreSQL. This app works everywhere except this AWS EC2 instance, so I know my Gemfile is correct. Any clues would help.
open irb & type require "pg" does it work? if not, then check that pg_ext exists in /usr/local/share/gems/gems/pg-0.14.0/lib/ directory. you can install manually postgresql gem manually, using
gem install pg
If this still doesn't work, ensure that you are using latest version of ruby & latest version of rubygems using gem environment command.if its the older version, you can install latest ones using rvm
use gem pg
than
bundle install
bundle update
please not use any version of pg
I face this error and solved by this

Incorrect MySQL client library version

I created a new rails project calling
rails new simple_cms
Then when in the directory I run
rails s
I get the follow errors
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/l
ib/mysql2/mysql2.rb:2:in `require': Incorrect MySQL client library version! This
gem was compiled for 6.0.0 but the client library is 5.5.24. (RuntimeError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-
x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-
x86-mingw32/lib/mysql2.rb:9:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-
x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:68:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:66:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:66:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:55:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler/runtime.rb:55:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/
lib/bundler.rb:119:in `require'
from c:/development/ruby/simple_cms/config/application.rb:7:in `<top (re
quired)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:53:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:53:in `block in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:50:in `tap'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have seen other people with this error but they tend to be linux users and I am running windows. I have attempted to reinstall both rails (railsinstaller.org) and mysql 5.5. I have used both the 32bit version as well as the 64bit version
There seem to be several questions on here already about this. Did you try their solutions?
Probably the most clear is this:
mysql2 gem compiled for wrong mysql client library
The pertinent part is here:
At the time of building this gem, the necessary DLL files where available
in the following download:
http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick
And put lib\libmysql.dll file in your Ruby bin directory, for example
C:\Ruby\bin
This will remove the gem and its dependencies. Then reinstalling will re-compile itself and all dependencies.
gem uninstall mysql2
bundle install
I had this error in a new project I was working on which suddenly stopped working in a windows machine that already had working rails projects, so it was clearly not an installation problem.
What caused the problem was a bundle update command, which decided to redownload mysql2 gem (for unknown reasons) and ignored my Gemfile line gem 'mysql2', '~> 0.2.6'.
The problem was that bundle update got mysql version 0.2.18, as shown in Gemfile.lock, in the following line:
mysql2 (0.2.18-x86-mingw32)
I'm note sure what the symbol means, but I replaced the following line in my gemfile
gem 'mysql2', '~> 0.2.6'
for
gem 'mysql2', '0.2.6'
And now everything works fine, including bundle update.

Rails rake throws error : no such file to load -- bundler/setup

When I run rake -T (or any rake command) I ran into this error:
$ rake -T
rake aborted!
no such file to load -- bundler/setup
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/myself/rails/RailApp1/config/boot.rb:6:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/myself/rails/RailApp1/config/application.rb:1:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/myself/rails/RailApp1/Rakefile:5:in `<top (required)>'
/usr/lib/ruby/1.9.1/rake.rb:2373:in `load'
/usr/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/usr/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/lib/ruby/1.9.1/rake.rb:1991:in `run'
/usr/bin/rake:28:in `<main>'
I have checked the location of rake and bundler:
$ which rake
/usr/bin/rake
$ which bundle
/usr/bin/bundle
I also found these directory.
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/
When I run bundle exec rake *:
$bundle exec rake -T
Could not find rake-0.9.2 in any of the sources
Run 'bundle install' to install missing gems
when I run bundle install in my application:
$bundle install
Using rake (0.9.2)
Using multi_json (1.0.3)
Using activesupport (3.1.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.1)
Using erubis (2.7.0)
Using rack (1.3.4)
Using rack-cache (1.1)
Using rack-mount (0.8.3)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.2)
Using actionpack (3.1.1)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.1.1)
Using arel (2.2.1)
Using tzinfo (0.3.30)
Using activerecord (3.1.1)
Using activeresource (3.1.1)
Using bundler (1.0.21)
Using coffee-script-source (1.1.2)
Using execjs (1.2.9)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.1)
Using rdoc (3.10)
Using thor (0.14.6)
Using railties (3.1.1)
Using coffee-rails (3.1.1)
Using jquery-rails (1.0.14)
Using rails (3.1.1)
Using sass (3.1.10)
Using sass-rails (3.1.4)
Using sqlite3 (1.3.4)
Using uglifier (1.0.3)
But the error remains, very confused about this..