Updated RubyGems: uninitialized constant Gem::ConfigFile::RbConfig - ruby-on-rails

After Updating RubyGems from version 1.3.5 => 1.8.19 every time I try to add a new gem I get this:
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:71:in `rescue in rescue in <class:ConfigFile>': uninitialized constant Gem::ConfigFile::RbConfig (NameError)
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:53:in `rescue in <class:ConfigFile>'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:49:in `<class:ConfigFile>'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:28:in `<top (required)>'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:9:in `require'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:9:in `<top (required)>'
from /usr/local/bin/gem:9:in `require'
from /usr/local/bin/gem:9:in `<main>'
I double checked that my /usr/local/bin/gem file has require 'rubygems/gem_runner' under require 'ruby gems'
So not sure why I'm getting this error, before it installed gems perfectly.

My bad, it was a ruby version mismatch with ruby gems. Upgrade fixed it.
Thanks

Related

search_up: undefined method 'untaint' error after Ruby upgrade

amateur coder here. In order to upgrade my Heroku stack, I have to move to a later Ruby version. I followed a tutorial to upgrade to Ruby 3.2.
After the upgrade, any time I try to do anything such as 'rails s' or 'bundle update', I get the error below. I've searched a lot online but can't find much of any use.
Any thoughts?
Many thanks for any tips
ec2-user:~/environment/website (master) $ bundle update
/home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:272:in `search_up': undefined method `untaint' for "/home/ec2-user/environment/website":String (NoMethodError)
current = File.expand_path(SharedHelpers.pwd).untaint
^^^^^^^^
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:259:in `find_file'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:251:in `find_gemfile'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:27:in `root'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler.rb:234:in `root'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler.rb:246:in `app_config_path'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler.rb:273:in `settings'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/feature_flag.rb:21:in `block in settings_method'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/cli.rb:97:in `<class:CLI>'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/cli.rb:7:in `<module:Bundler>'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/cli.rb:6:in `<top (required)>'
from <internal:/home/ec2-user/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/3.2.0+1/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/home/ec2-user/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/3.2.0+1/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/exe/bundle:23:in `block in <top (required)>'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/bin/bundle:25:in `load'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/bin/bundle:25:in `<main>'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/bin/ruby_executable_hooks:22:in `eval'
from /home/ec2-user/.rvm/gems/ruby-3.2.0-preview1/bin/ruby_executable_hooks:22:in `<main>'
Ruby 3.2.0 has removed some deprecated methods (taint/trust/untaint/untrust) ,ref: https://bugs.ruby-lang.org/issues/16131 . Bundler version 1.17.3 has that method in shared_helpers.rb . Try updating bundler to 2.4.1 .
Please check before installed Gemfile.lock
you should remove Gemfile.lock before. ( cause, lock file is depends on old version ruby )

"rake routes" causes syntax error: time_zone.rb circular argument reference - now

I am trying to run rake routes, but I am getting this error (see full stack trace below):
rake aborted!
SyntaxError: /usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/values/time_zone.rb:270: circular argument reference - now
How can I resolve this?
Attempts to resolve the problem
I tried bundle install and bundle update, which both ran successfully. However, this did not resolve the circular argument error resulting from rake routes.
More Info
Bundler version: 1.10.6
Ruby version: 2.7.1p83
Rake version: 13.0.1
Rails version: 3.2.12
SyntaxError: /usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/values/time_zone.rb:270: circular argument reference - now
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/time_with_zone.rb:1:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/time_with_zone.rb:1:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/core_ext/time/zones.rb:1:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/core_ext/time/zones.rb:1:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/core_ext/date/zones.rb:2:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/core_ext/date/zones.rb:2:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/core_ext/date/calculations.rb:4:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/core_ext/date/calculations.rb:4:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/ruby/shim.rb:12:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-3.2.12/lib/active_support/ruby/shim.rb:12:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/actionpack-3.2.12/lib/abstract_controller.rb:6:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/actionpack-3.2.12/lib/abstract_controller.rb:6:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/actionpack-3.2.12/lib/action_controller.rb:1:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/actionpack-3.2.12/lib/action_controller.rb:1:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/actionpack-3.2.12/lib/action_controller/railtie.rb:2:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/actionpack-3.2.12/lib/action_controller/railtie.rb:2:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-3.2.12/lib/active_record/railtie.rb:9:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-3.2.12/lib/active_record/railtie.rb:9:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-3.2.12/lib/rails/all.rb:12:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-3.2.12/lib/rails/all.rb:12:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-3.2.12/lib/rails/all.rb:10:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-3.2.12/lib/rails/all.rb:10:in `<top (required)>'
My Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.12'
gem 'mysql2', '0.5.3'
gem 'rubycas-client'
gem 'exception_notification'
gem 'jquery-rails'
gem 'json', '>=1.8.3'
gem 'test-unit'
According to the release notes, Rails 3.2 only supports Ruby 1.8.7 and Ruby 1.9.2. You are using Ruby 2.7.1.
Please note that Ruby on Rails 3.2 is no longer supported by the community since 2016, and Ruby 1.8.7 and 1.9.2 are no longer supported by the community since 2014.
There is a company that sells Long-Term Support for Ruby on Rails: https://railslts.com/. You can buy a support plan for Ruby on Rails 3.2 for only 150$/month, and their version also supports Ruby 2.5. Ruby 2.5 is no longer actively developed by the community, but it still receives critical security fixes by the community until 2021-03-31.

rake aborted! NameError: uninitialized constant ActiveRecord::VERSION error while using rake db:migrate

I am new to ruby on rails. I want to re-create a production setup on my local system for development purposes.I seem to have run into a problem during migration of database.
I am using Ubuntu 18.04 OS. I have installed mysql-server, ruby 2.3.2 , rails 5.0, libmysqld-dev and mysql2 gem successfully. I was able to create a database and import the SQL file for table creation. To do pending migration, I executed rake db:migrate. I am getting the following error.
rake aborted!NameError: uninitialized constant ActiveRecord::VERSION
/home/raj/.rvm/gems/ruby-2.3.2/gems/activerecord-session_store-1.1.1/lib/action_dispatch/session/active_record_store.rb:151:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/gems/activerecord-session_store-1.1.1/lib/active_record/session_store.rb:2:in `require'
/home/raj/.rvm/gems/ruby-2.3.2/gems/activerecord-session_store-1.1.1/lib/active_record/session_store.rb:2:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/gems/activerecord-session_store-1.1.1/lib/activerecord/session_store.rb:1:in `require'
/home/raj/.rvm/gems/ruby-2.3.2/gems/activerecord-session_store-1.1.1/lib/activerecord/session_store.rb:1:in `<top (required)>'
/home/raj/IRIS/config/application.rb:7:in `<top (required)>'
/home/raj/IRIS/Rakefile:4:in `require'
/home/raj/IRIS/Rakefile:4:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:24:in `eval'
/home/raj/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:24:in `<main>'
LoadError: cannot load such file -- activerecord-session_store
/home/raj/IRIS/config/application.rb:7:in `<top (required)>'
/home/raj/IRIS/Rakefile:4:in `require'
/home/raj/IRIS/Rakefile:4:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:24:in `eval'
/home/raj/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:24:in `<main>'
(See full trace by running task with --trace)
Regarding the error in active_record_store.rb line number 151, the code is as follows:
if ActiveRecord::VERSION::MAJOR == 4
require 'action_dispatch/session/legacy_support'
ActionDispatch::Session::ActiveRecordStore.send(:include, ActionDispatch::Session::LegacySupport)
end
During RVM installation rails latest version was also installed somehow. Removing all the gems and doing bundle install worked.
Try running the below mentioned command
gem install activerecord
Hope this helps.
Can you add this to the top of active_record_store.rb to see if it works?
require 'active_record/version'

error during installing ruby on rails application uninitialized constant Gem::BasicSpecification (NameError)

I am trying to install ruby on rails application fedena on Ubuntu server.
It uses some old ruby library. I followed the instructions on
http://paritosh.passion8.co.in/post/49878771105/fedena-installation-guide
gem install rubygems-update -v=1.3.7
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:43:in `<top (required)>': uninitialized constant Gem::BasicSpecification (NameError)
from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:1113:in `require'
from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:1113:in `<top (required)>'
from <internal:gem_prelude>:4:in `require'
from <internal:gem_prelude>:4:in `<internal:gem_prelude>'
If you are using RVM, then run
rvm install rubygems 1.3.7
this worked for me

heroku not working /heroku/commands/pgbackups.rb:9:in `<class:Pgbackups>': uninitialized constant Heroku::Command::Pgbackups::Help (NameError)

If i tipe heroku in console, i become this:
~onemore~>heroku
/home/koli/.rvm/gems/ruby-1.9.2-p0#onemore/gems/heroku-1.13.1/lib/heroku/commands/pgbackups.rb:9:in `': uninitialized constant Heroku::Command::Pgbackups::Help (NameError)
from /home/koli/.rvm/gems/ruby-1.9.2-p0#onemore/gems/heroku-1.13.1/lib/heroku/commands/pgbackups.rb:6:in `<module:Command>'
from /home/koli/.rvm/gems/ruby-1.9.2-p0#onemore/gems/heroku-1.13.1/lib/heroku/commands/pgbackups.rb:5:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/koli/.rvm/gems/ruby-1.9.2-p0#onemore/gems/heroku-1.13.1/lib/heroku/command.rb:5:in `block in <top (required)>'
from /home/koli/.rvm/gems/ruby-1.9.2-p0#onemore/gems/heroku-1.13.1/lib/heroku/command.rb:5:in `each'
from /home/koli/.rvm/gems/ruby-1.9.2-p0#onemore/gems/heroku-1.13.1/lib/heroku/command.rb:5:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/koli/.rvm/gems/ruby-1.9.2-p0#onemore/gems/heroku-1.13.1/bin/heroku:7:in `<top (required)>'
from /home/koli/.rvm/gems/ruby-1.9.2-p0#onemore/bin/heroku:19:in `load'
from /home/koli/.rvm/gems/ruby-1.9.2-p0#onemore/bin/heroku:19:in `<main>'
I installed rvm, then ruby 1.9.2, then rails 3.0.1. Then i had make a new project with rails new onemore.
I had make a gemset for it. After that, i installed rails 3.0.1 in that gemset too, and then bundle install. After that i installed heroku with gem install heroku.
I have no idea how to fix this problem... I reinstalled everything, but the same...
Any idea, or hint?
Thanks:Koli
Have you enabled the pgbackup addon in Heroku? Something like
$ sudo gem install heroku
$ heroku addons:add pgbackups:basic
$ heroku pgbackups:capture

Resources