Bundle command the wrong mysql2 gem (always 0.3.2) - ruby-on-rails

I got an error when trying to run $rails console
/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.16.dylib (LoadError)
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
from /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2.rb:8
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:112:in `require'
from /Users/ccool2486/Sites/test3mysql/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:21:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:21
from script/rails:6:in `require'
from script/rails:6
ccool-2:test3mysql ccool2486$ rails console
WARNING: This version of mysql2 (0.3.2) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `establish_connection': Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter) (RuntimeError)
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/railtie.rb:59
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:43:in `run_load_hooks'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/base.rb:1903
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.6/lib/active_record/railtie.rb:32
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `call'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `to_proc'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/railtie.rb:180:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/railtie.rb:180:in `load_console'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/application.rb:154:in `load_console'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/application/railties.rb:11:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/application/railties.rb:11:in `all'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/application.rb:154:in `load_console'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands/console.rb:26:in `start'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands/console.rb:8:in `start'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:23
from script/rails:6:in `require'
from script/rails:6
Hmm... so i tried to uninstall the mysql2 gem, and reinstall the version 0.2.7 gem
sudo gem uninstall mysql2 -i /Library/Ruby/Gems/1.8
And I changed the gemfile:
gem 'mysql2','0.2.7'
Ran Bundler in my app directory:
bundle install
But it installed the version 0.3.2 back again!!! Can anyone help, I honestly don't know what happened here.

sudo gem uninstall mysql2
in Gemfile gem 'mysql2', '< 0.3'
bundle update

with your
gem 'mysql2','0.2.7'
Try
bundle update
it builds the bundle from scratch

Related

ruby-debug-ide command exploading in my face

So I'm working on getting some sweet sweet remote debugging action on an old app and found some instructions via https://github.com/ruby-debug/ruby-debug-ide to get my rubymine going. Installing these two gems in my Gemfile...
gem 'ruby-debug-base19x', '~> 0.11.32'
gem 'ruby-debug-ide'
gems installed fine
BUT when I load up the rdebug command i get this error...
$ rdebug
/home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require': /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_current_thread - /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so (LoadError)
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/bin/rdebug:108:in `require_relative'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/bin/rdebug:108:in `<top (required)>'
from /home/fonso/.rbenv/versions/1.9.3-p551/bin/rdebug:23:in `load'
from /home/fonso/.rbenv/versions/1.9.3-p551/bin/rdebug:23:in `<main>'
even the full rdebug-ide command exploads in my face
$ rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- rails s
/home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require': /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_current_thread - /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so (LoadError)
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide.rb:6:in `<top (required)>'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.7.2/bin/rdebug-ide:8:in `require_relative'
from /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.7.2/bin/rdebug-ide:8:in `<top (required)>'
from /home/fonso/.rbenv/versions/1.9.3-p551/bin/rdebug-ide:23:in `load'
from /home/fonso/.rbenv/versions/1.9.3-p551/bin/rdebug-ide:23:in `<main>'
Any ideas on how to solve this mystery?
Ok so using gem list and passing grep debug I found I had some odd gems in my box
$ gem list | grep debug
debug_inspector (0.0.3)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.3.8)
ruby-debug-base19 (0.11.25)
ruby-debug-base19x (0.11.32)
ruby-debug-ide (0.7.2)
ruby-debug19 (0.11.6)
Note the two ruby-debug-base19 thingies? yeah, I suspected that might be a problem along with a few others. So doing some gem uninstall I end up with...
$ gem list | grep debug
debug_inspector (0.0.3)
debugger-ruby_core_source (1.3.8)
ruby-debug-base19x (0.11.32)
ruby-debug-ide (0.7.2)
Now when I run my debug command for rubymine it works
rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 26162 -- rails s
Fast Debugger (ruby-debug-ide 0.7.2, ruby-debug-base19x 0.11.32, file filtering is not supported) listens on 0.0.0.0:1234
Woo Hoo!

can't find gem bundler Ruby

Using Mac OS 13, rbenv.
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
Rails 5.1.4
Bundler version 1.16.1
rbenv 1.1.1
I'm trying to start a new Rails application and then getting this:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem bundler (>= 0) (Gem::GemNotFoundException)
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/generators/app_base.rb:382:in `bundle_command'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/generators/app_base.rb:416:in `run_bundle'
from (eval):1:in `run_bundle'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/application/application_command.rb:24:in `perform'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/cli.rb:16:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/exe/rails:9:in `<top (required)>'
from /usr/local/bin/rails:22:in `load'
from /usr/local/bin/rails:22:in `<main>'
As I understand it has something to do with a version of Ruby but I have no idea how to resolve the issue.
It looks like you may need to do a gem install bundler and get the bundler gem to get rails up and running.
STEP (1): install the bundler gem:
sudo gem install bundler
Once completed, you should get a message similar to this:
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Installing ri documentation for bundler-1.16.1
Done installing documentation for bundler after 6 seconds
1 gem installed
STEP (2): try checking the bundler version:
bundle -v
You should get a version number like this:
Bundler version 1.16.1
STEP (3): now you can use bundle install:
bundle install
I hope my answer helps.

Error while running bundle in rails 4.2.4

I tried running bundle over rbenv but I got this error:
/home/armyalone/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require': cannot load such file -- bundler (LoadError)
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/generators/app_base.rb:319:in `bundle_command'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/generators/app_base.rb:335:in `run_bundle'
from (eval):1:in `run_bundle'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/plugin.rb:23:in `<top (required)>'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/cli.rb:12:in `<top (required)>'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /home/armyalone/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/bin/rails:9:in `<top (required)>'
from /home/armyalone/.rbenv/versions/2.2.3/bin/rails:23:in `load'
from /home/armyalone/.rbenv/versions/2.2.3/bin/rails:23:in `<main>'
Then I tried these commands:
$ gem -v
2.5.0
$ rails -v
Rails 4.2.4
$ bundle -v
Bundler version 1.10.6
$ rbenv -v
rbenv 0.4.0-205-g5fb9c84
Why can't I run bundler?
Run the below command in your terminal
gem install rb-readline
Hope it helps!
I changed the source from https://rubygems.org to http://rubygems.org and ran:
gem update --system
bundle install
now it's working.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension Mavericks

am learning rails using this website http://tutorials.jumpstartlab.com/projects/blogger.html and whenever I try starting the server using rails server, I get this error on the terminal
Could not find gem 'sqlite3 (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
After running the command bundle install, I get the error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/Cellar/ruby/2.1.2_3/bin/ruby extconf.rb
/Users/andrewmolo/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:71:in `initialize': Permission denied # rb_sysopen - /usr/local/Cellar/ruby/2.1.2_3/bin/rake (Errno::EACCES)
from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:71:in `open'
from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:71:in `block in try_to_fix_binstubs'
from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:69:in `map'
from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:69:in `try_to_fix_binstubs'
from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:46:in `block in execute_no_wrapper'
from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:44:in `each'
from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:44:in `execute_no_wrapper'
from extconf.rb:19:in `<main>'
bundler 1.9.1
erubis 2.7.0
executable-hooks 1.3.2
nokogiri 1.6.6.2
rack 1.6.0
railties 4.2.1
rake 10.1.0
extconf failed, exit code 1
Gem files will remain installed in /Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/executable-hooks-1.3.2 for inspection.
Results logged to /Users/UserX/.rvm/gems/ruby-2.2.0#global/extensions/x86_64-darwin-13/2.1.0/executable-hooks-1.3.2/gem_make.out
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:38:in `block in build'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/tempfile.rb:324:in `open'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in `build'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `chdir'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `block in build_extension'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:924:in `each'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems.rb:185:in `try_activate'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/vendor/net/http/persistent.rb:12:in `<top (required)>'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/vendored_persistent.rb:11:in `<top (required)>'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/fetcher.rb:1:in `<top (required)>'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/cli/install.rb:72:in `run'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/cli.rb:157:in `install'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/cli.rb:10:in `start'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/bin/bundle:20:in `block in <top (required)>'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/lib/bundler/friendly_errors.rb:7:in `with_friendly_errors'
/Users/UserX/.rvm/gems/ruby-2.2.0#global/gems/bundler-1.9.1/bin/bundle:18:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Environment
Bundler 1.9.1
Rubygems 2.2.2
Ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
GEM_HOME /Users/andrewmolo/.rvm/gems/ruby-2.2.0
GEM_PATH /Users/andrewmolo/.rvm/gems/ruby-2.2.0:/Users/andrewmolo/.rvm/gems/ruby-2.2.0#global
RVM 1.26.10 (latest)
Git 1.8.5.2
rubygems-bundler (1.4.4)
OS = Mavericks 10.9.5
I don't know if this will help people with this issue but I was having the same error. What I ended up doing to fix it is commenting out the sqlite gem in my gemfile for the app. Granted I just did this a few minutes ago so I don't know if I'll run into any other issues but I use Postgres so if you use something else too, there shouldn't be an issue. Hope this helps others like me that were looking for answers.
Looks like bundler has no permission to write into your file system.
Permission denied # rb_sysopen - /usr/local/Cellar/ruby/2.1.2_3/bin/rake (Errno::EACCES)
Try running your command as sudo:
sudo bundle install
I believe the issue is the Gemfile.lock thats not allowing you to use the latest version of of each of your gems.
To update your Gemfile.lock run the command:
bundle update
in the same directory as your Gemfile.lock file then try bundle install again.

Ruby on Rails - Install execjs on Debian

I'm trying to install ruby on rails on debian... I installed everything.
I installed execjs, therubyracer and node.js, too.
Everytime i wanna create a new controller it says:
/usr/local/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /usr/local/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
from /usr/local/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/uglifier-2.2.1/lib/uglifier.rb:3:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/uglifier-2.2.1/lib/uglifier.rb:3:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/adattilo/test/testt/config/application.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:44:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:44:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I made a reboot after the installation of execjs, therubyracer and node.js...
For platforms for which there is binary version of therubyracer gem available, there are no dependencies other than ruby and rubygems. If there is not a binary version for your system, then you will need to compile it from source. To do this, you must have v8 > 3.11.8 installed somewhere on your system.
Try adding following to your Gemfile
gem 'therubyracer', '0.11.0beta5'
gem 'libv8', '~> 3.11.8'
Now, cd to your project and bundle install
$ cd <project>
$ bundle install

Resources