Error with Ruby gems (Ruby on Rails) - ruby-on-rails

I'm still getting an error with my gemfile, I can Download all the gems, but at the moment of 'rails server' I'm getting this error:
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'will_paginate'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant ActiveSupport::LogSubscriber
Backtrace for gem load error is:
/home/administrador/.rvm/gems/ruby-2.4.0/gems/activerecord-3.0.5/lib/active_record/log_subscriber.rb:2:in `<module:ActiveRecord>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/activerecord-3.0.5/lib/active_record/log_subscriber.rb:1:in `<top (required)>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/activerecord-3.0.5/lib/active_record/base.rb:24:in `<top (required)>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/will_paginate-2.3.15/lib/will_paginate.rb:33:in `require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/will_paginate-2.3.15/lib/will_paginate.rb:33:in `enable_activerecord'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/will_paginate-2.3.15/lib/will_paginate.rb:88:in `<top (required)>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `each'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `block in require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `each'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler.rb:106:in `require'
/home/administrador/Documents/forminst4/config/application.rb:7:in `<top (required)>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:28:in `require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:28:in `block in <top (required)>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:27:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Bundler Error Backtrace:
from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `each'
from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `block in require'
from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `each'
from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `require'
from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler.rb:106:in `require'
from /home/administrador/Documents/forminst4/config/application.rb:7:in `<top (required)>'
from /home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:28:in `require'
from /home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:28:in `block in <top (required)>'
from /home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap'
from /home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
This is my gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2', '~> 0.2.6'
gem 'prawn', '0.8.4'
gem 'jquery-rails'
gem 'carrierwave'
gem 'will_paginate', '2.3.15'
gem 'net-ldap', '0.3.1'
gem 'cancan', '1.6.10'
gem 'therubyracer'
I'll really appreciate it if you can help me with this! Thanks a lot
Edit: I've tried adding "gem 'will_paginate', '~> 3.1.0'" to my gemfile.. and when I run rails server I get this error
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'cancan'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant AbstractController::ViewPaths
Backtrace for gem load error is:
/home/administrador/.rvm/gems/ruby-2.4.0/gems/actionpack-3.0.5/lib/abstract_controller/rendering.rb:36:in `<module:Rendering>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/actionpack-3.0.5/lib/abstract_controller/rendering.rb:33:in `<module:AbstractController>'....(same as above)

just update your gemfile with
gem 'will_paginate', '~> 3.1.0'
rails 3 or 3+ version need above version for will paginate
refer this https://github.com/mislav/will_paginate

Related

How to fix the 'mysql2' error when loading rails console?

I'm trying to start up the rails console ( not related to my previous questions since these are different errors ) and I can't, for the life of me, figure out how to fix this or what's even asking me to do. I'm running: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux].
I type in the rails console command and get the following:
ubuntu:~/environment/sample_app (sign-up) $ rails console
/home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem': Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? mysql2 is not part of the bundle. Add it to your Gemfile. (LoadError)
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/connection_specification.rb:169:in `spec'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1052:in `establish_connection'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_handling.rb:51:in `establish_connection'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/railtie.rb:201:in `block (2 levels) in <class:Railtie>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/base.rb:327:in `<module:ActiveRecord>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/base.rb:27:in `<main>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:370:in `active_record_configured?'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:287:in `disconnect_database'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:111:in `preload'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
ubuntu:~/environment/sample_app (sign-up) $ rails console
/home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem': Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? mysql2 is not part of the bundle. Add it to your Gemfile. (LoadError)
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/connection_specification.rb:169:in `spec'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1052:in `establish_connection'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_handling.rb:51:in `establish_connection'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/railtie.rb:201:in `block (2 levels) in <class:Railtie>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/base.rb:327:in `<module:ActiveRecord>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/base.rb:27:in `<main>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:370:in `active_record_configured?'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:287:in `disconnect_database'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:111:in `preload'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
UPDATE
this is what my gemfile looks like currently.
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rails', '6.0.3.1'
gem 'mysql2', '~> 0.3.20'
gem 'image_processing', '1.9.3'
gem 'mini_magick', '4.9.5'
gem 'active_storage_validations', '0.8.9'
gem 'bcrypt', '3.1.13'
gem 'faker', '2.11.0'
gem 'will_paginate', '3.3.0'
gem 'bootstrap-will_paginate', '1.0.0'
gem 'bootstrap-sass', '3.4.1'
gem 'puma', '4.3.5'
gem 'sass-rails', '6.0.0'
gem 'webpacker', '4.2.2'
gem 'turbolinks', '5.2.1'
gem 'jbuilder', '2.10.0'
gem 'bootsnap', '1.4.6', require: false
group :development, :test do
gem 'sqlite3', '1.4.2'
gem 'byebug', '11.1.3', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'web-console', '4.0.2'
gem 'listen', '3.2.1'
gem 'spring', '2.1.0'
gem 'spring-watcher-listen', '2.0.1'
end
group :test do
gem 'capybara', '3.32.2'
gem 'selenium-webdriver', '3.142.7'
gem 'webdrivers', '4.3.0'
gem 'rails-controller-testing', '1.0.4'
gem 'minitest', '5.11.3'
gem 'minitest-reporters', '1.3.8'
gem 'guard', '2.16.2'
gem 'guard-minitest', '2.4.6'
end
group :production do
gem 'pg', '1.2.3'
gem 'aws-sdk-s3', '1.46.0', require: false
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
# Uncomment the following line if you're running Rails
# on a native Windows system:
# gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
I tried the suggestions given, but now my error looks like this when I try to run 'rails console'. Bundle install works fine.
ubuntu:~/environment/sample_app (sign-up) $ rails console
/home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem': Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? can't activate mysql2 (>= 0.4.4), already activated mysql2-0.3.21. Make sure all dependencies are added to Gemfile. (LoadError)
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/connection_specification.rb:169:in `spec'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1052:in `establish_connection'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/connection_handling.rb:51:in `establish_connection'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/railtie.rb:201:in `block (2 levels) in <class:Railtie>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.3.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/base.rb:327:in `<module:ActiveRecord>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.3.1/lib/active_record/base.rb:27:in `<main>'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:370:in `active_record_configured?'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:287:in `disconnect_database'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:111:in `preload'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
from /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
Ensure ‘mysql2’ is included in your gem file and run bundle install
The key part of the error message is:
Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? mysql2 is not part of the bundle. Add it to your Gemfile.

cannot load such file -- bcrypt_ext (LoadError) on windows

I have ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32] and rails 5.1.4. I am getting following error when i run rails s command.
rails s
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require': cannot load such file -- bcrypt_ext (LoadError)
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in `rescue in <top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:83:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:83:in `block (2 levels) in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:78:in `each'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:78:in `block in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:67:in `each'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:67:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler.rb:114:in `require'
from E:/Rauf Personal Data/work/rails/shine/config/application.rb:7:in `<top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `block in perform'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I have almost tried every solution but i am unable to resolve this issue. Can any body please help me to sort out this issue. I already tried following:
Firstly uninstall bcrypt and bcrypt-ruby by running these two commands:
gem uninstall bcrypt and gem uninstall bcrypt-ruby
Install it again with gem install bcrypt --platform=ruby
In your Gemfile write gem 'bcrypt-ruby', '3.1.5', :require => 'bcrypt'
Run bundle install
I have managed to solve this issue by adding following line in the Gemfile....
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
After trying several methods, the above worked for me:
1) Stop all rails servers.
2) Add : gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' to the gemfile.
3) bundle install.

In Rubymine, Rails fails to load 'uglifier' gem

I have an issue while running Rails from Rubymine where it fails to load the uglifier gem with the stack below. Note that Node.js is installed on my Windows 7 computer.
From cmd.exe, 'rails s' works well : the web application starts.
From RubyMine run button, default configuration, I get the error :
"C:\Program Files (x86)\JetBrains\RubyMine 8.0.2\bin\runnerw.exe" C:\tools\languages\RailsInstaller\Ruby2.2.0\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/projects/perso/exercises/bin/rails server -b 127.0.0.1 -p 3000 -e development
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from C:/projects/perso/exercises/config/application.rb:7:in `<top (required)>'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from C:/projects/perso/exercises/bin/rails:4:in `require'
from C:/projects/perso/exercises/bin/rails:4:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
I get the same error from RubyMine terminal.
Here's some information on my environment from (same output from cmd.exe and RubyMine) :
>rails --version
Rails 4.2.6
>node --version
v0.10.22
>ruby --version
ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]
Ruby was installed using Rails Installer on a Windows 7 computer.
Node.js is installed too, using official installer.
RubyMine 8.0.4 (ultimate, not sure if there's a community version too)
I suspect an environment problem inside RubyMine in which rails/bundler/gem/? can't "see" Node.js, where cmd.exe can.
I think the error started when I tryed to start RubyMine debug mode.
Any idea on how to solve the issue ?
Thanks
Edit : some more information
My Gemfile :
source 'https://rubygems.org'
gem 'rails', '4.2.6'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bcrypt', '~> 3.1.7'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
rake tasks (for example to get the full error stack, note the ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. )
>rake tasks --trace
rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'uglifier'.
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
C:/projects/perso/exercises/config/application.rb:7:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/projects/perso/exercises/Rakefile:4:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/bin/rake:23:in `load'
C:/tools/languages/RailsInstaller/Ruby2.2.0/bin/rake:23:in `<main>'
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/execjs-2.6.0/lib/execjs/runtimes.rb:48:in `autodetect'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/execjs-2.6.0/lib/execjs.rb:5:in `<module:ExecJS>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/execjs-2.6.0/lib/execjs.rb:4:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
C:/projects/perso/exercises/config/application.rb:7:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/projects/perso/exercises/Rakefile:4:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/bin/rake:23:in `load'
C:/tools/languages/RailsInstaller/Ruby2.2.0/bin/rake:23:in `<main>'
I had the same problem, though my solution isn't that simple!
I have a run configuration that has field "Environment variables" set with PATH=d:\opt\curl-7.40.0-devel-mingw64\bin\;%PATH%;=. But when I click on "..." right to this field, in value column it says d:\opt\curl-7.40.0-devel-mingw64\bin\;%PATH%" (without the "=" at the end).
I changed it so that it includes the path to node.exe
PATH=d:\opt\curl-7.40.0-devel-mingw64\bin\;d:\opt\nodejs\;%PATH%;
Now it works fine.
I run ruby 2.2.3-x64 with Rails 4.2.5 on a Windows 10 machine.
Check if your Gemfile has the following gem
gem 'uglifier'
If you already have the gem in Gemfile, then run bundle install and check if the bundle in installing the uglifier gem.
I finally got it working, here's the context and solution if someone else has the same issue.
I have defined a user scoped Path variable which was refering to my system Path as :
%Path%;C:\tools\…
In RedMine, this %Path% was not interpreted anymore (don't know why). I saw it by typing in RubyMine Terminal :
echo %Path%
The result was displaying "%Path%", not its content.
I solved the problem by simply rebooting the computer.

cannot load such file -- activerecord (LoadError)

I'm trying to upgrade a very old app from Rails 2.3.12 to Rails 3.0.0 (as a starting point to getting it to Rails 4). I've been slowly going through and fixing anything that has broken since the upgrade by removing old gems etc.
I've got stuck on a problem that I can't seem to pin point or fix.
I'm running Rails3, Ruby1.9.3
When I try to run the rails server I get the following error:
=> Booting WEBrick
=> Rails 3.0.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require': cannot load such file -- activerecord (LoadError)
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/Documents/Work/Saild/saild/vendor/plugins/acts_as_commentable/lib/commentable_methods.rb:1:in `<top (required)>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/Documents/Work/Saild/saild/vendor/plugins/acts_as_commentable/lib/acts_as_commentable.rb:1:in `<top (required)>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/Documents/Work/Saild/saild/vendor/plugins/acts_as_commentable/rails/init.rb:1:in `block in <class:Plugin>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/plugin.rb:81:in `eval'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/plugin.rb:81:in `block in <class:Plugin>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `instance_exec'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `run'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `each'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `run_initializers'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/application.rb:134:in `initialize!'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/application.rb:77:in `method_missing'
from /home/camillavk/Documents/Work/Saild/saild/config/environment.rb:7:in `<top (required)>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/Documents/Work/Saild/saild/config.ru:3:in `block in <main>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/builder.rb:46:in `instance_eval'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/builder.rb:46:in `initialize'
from /home/camillavk/Documents/Work/Saild/saild/config.ru:1:in `new'
from /home/camillavk/Documents/Work/Saild/saild/config.ru:1:in `<main>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/builder.rb:35:in `eval'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/builder.rb:35:in `parse_file'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/server.rb:162:in `app'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/server.rb:253:in `wrapped_app'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/server.rb:204:in `start'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/commands/server.rb:65:in `start'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/commands.rb:27:in `tap'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
My Gemfile looks like this:
source 'https://rubygems.org'
gem "rails", "3.0.0"
gem "airbrake"
gem "aws-s3"
gem "bj"
gem "bundler", "~> 1.0.0"
gem "calendar_date_select", "1.15"
gem "cancan", "1.2.0"
gem "carmen"
gem 'comma', '0.4.1'
gem 'exifr'
# factory_girl 1.2.4 wasn't working with Rails 3 - consider an upgrade to factory_girl_rails?
# gem "factory_girl", "1.2.4"
gem 'fastercsv'
gem "geokit"
gem "haml"
gem "hpricot"
gem 'hoptoad_notifier'
gem "jrails"
gem "libxml-ruby", "2.4.0"
gem "memcached", "~> 1.8.0"
#memcached no longer works?
gem 'dalli'
# Not sure why we have this if we're using SQLite3
gem "mysql2", "~> 0.2.6"
#TODO: changed by almazom
gem "rake", "0.8.4"
gem 'recurly'
gem "rdoc"
gem "rmagick"
gem "rspreedly"
gem "rubyzip"
gem 'sass'
#need to use simplecov when upgrading to ruby 2 as rcov doesn't work
gem "simplecov"
gem 'sqlite3'
# tmail no longer included in rails 3?
gem 'tmail'
gem "will_paginate", "2.3.16"
gem 'yaml_db'
group :development, :test do
gem 'test-unit', '1.2.3'
gem 'rspec', '1.3.2'
gem 'rspec-rails', '~> 1.3.4'
end
group :test do
gem 'capybara', '0.3.5'
gem 'cucumber', '1.1.2'
gem 'cucumber-rails', :git => "git://github.com/RKelln/cucumber-rails.git", :branch => "0.3.2-capybara-fix"
gem 'database_cleaner'
end
Has anyone else encountered this problem before when upgrading to Rails 3? I can't find anything on Google about it....
Or does anyone have a suggestion on how I can find/fix the issue?
Many thanks in advance!
Let's take a look at your stack trace. Stack traces are read top to bottom. If you have function A calling function B calling function C, where an error happens, the stack trace shows
C
B
A
We can see that the first lines all come from Rails itself:
/home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require': cannot load such file -- activerecord (LoadError)
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
Since it's usually unlikely that Rails itself is the culprit, we look for the first line that comes from some place else — either your own code, or a third-party library.
The next line is just that:
from /home/camillavk/Documents/Work/Saild/saild/vendor/plugins/acts_as_commentable/lib/commentable_methods.rb:1:in `<top (required)>'
We see that it's code at vendor/plugins, making it an old, Rails 2.3-style plugin. They were deprecated in Rails 3, and completely stopped working in Rails 4. They were replaced by "Gem plugins" that are added through your Gemfile and Bundler, instead of vendor/plugins.
So acts_as_commentable is a good candidate as the culprit. The Github project page shows a version especially for Rails 3, so removing the old plugin and replacing it with that Gem gives you a good shot at fixing this issue.

I am unable to start a rails server with the gem sovren installed :undefined method `to_sym' for nil:NilClass

I started a new rails app my Gem file as below:
source 'http://rubygems.org'
ruby '1.9.3'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.0'
gem 'bcrypt-ruby', '3.0.1'
gem 'pg', '0.15.1'
gem 'sovren'
I am unsure why i get this error
/Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:56:in `block in require': undefined method `to_sym' for nil:NilClass (NoMethodError)
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:56:in `map!'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:56:in `require'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/sovren-0.0.5/lib/sovren.rb:1:in `<top (required)>'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/toad/Code/Ruby/sovren/sovren_app/config/application.rb:7:in `<top (required)>'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /Users/toad/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I remove gem 'sovren' and it works.
What could be the issue?

Resources