Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails server throws `require': cannot load such file -- bigdecimal/util (LoadError)

In Rails 3.2.12, when I run rails s it throws

/usr/local/share/gems/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- bigdecimal/util (LoadError)

I even added gem 'bigdecimal' to Gemfile but still I am getting the same error, any pointers?

like image 889
Alagunambi Welkin Avatar asked Jan 13 '23 08:01

Alagunambi Welkin


2 Answers

I had this issue with Rails 5.0.2 on a brand new Rails-generated application. The problem was that bigdecimal was not being loaded from my updated gemset but from the ruby-2.3.0 default gemset. This was resolved by adding gem 'bigdecimal' to my Gemfile.

<gem-root>/gems/activesupport-5.0.2/lib/active_support/core_ext/big_decimal/conversions.rb:2:in `require': cannot load such file -- bigdecimal/util (LoadError)
    from <gem-root>/gems/activesupport-5.0.2/lib/active_support/core_ext/big_decimal/conversions.rb:2:in `<top (required)>'
    from <gem-root>/gems/activesupport-5.0.2/lib/active_support/core_ext/object/json.rb:4:in `require'
    from <gem-root>/gems/activesupport-5.0.2/lib/active_support/core_ext/object/json.rb:4:in `<top (required)>'
    from <gem-root>/gems/activesupport-5.0.2/lib/active_support/core_ext/object.rb:11:in `require'
    from <gem-root>/gems/activesupport-5.0.2/lib/active_support/core_ext/object.rb:11:in `<top (required)>'
    from <gem-root>/gems/railties-5.0.2/lib/rails/configuration.rb:2:in `require'
    from <gem-root>/gems/railties-5.0.2/lib/rails/configuration.rb:2:in `<top (required)>'
    from <gem-root>/gems/railties-5.0.2/lib/rails/railtie/configuration.rb:1:in `require'
    from <gem-root>/gems/railties-5.0.2/lib/rails/railtie/configuration.rb:1:in `<top (required)>'
    from <gem-root>/gems/railties-5.0.2/lib/rails/railtie.rb:216:in `require'
    from <gem-root>/gems/railties-5.0.2/lib/rails/railtie.rb:216:in `config'
    from <gem-root>/gems/railties-5.0.2/lib/rails/railtie.rb:122:in `config'
    from <gem-root>/gems/activesupport-5.0.2/lib/active_support/i18n_railtie.rb:7:in `<class:Railtie>'
    from <gem-root>/gems/activesupport-5.0.2/lib/active_support/i18n_railtie.rb:6:in `<module:I18n>'
    from <gem-root>/gems/activesupport-5.0.2/lib/active_support/i18n_railtie.rb:5:in `<top (required)>'
    from <gem-root>/gems/activesupport-5.0.2/lib/active_support/railtie.rb:2:in `require'
    from <gem-root>/gems/activesupport-5.0.2/lib/active_support/railtie.rb:2:in `<top (required)>'
    from <gem-root>/gems/railties-5.0.2/lib/rails.rb:15:in `require'
    from <gem-root>/gems/railties-5.0.2/lib/rails.rb:15:in `<top (required)>'
    from <gem-root>/gems/railties-5.0.2/lib/rails/commands/server.rb:4:in `require'
    from <gem-root>/gems/railties-5.0.2/lib/rails/commands/server.rb:4:in `<top (required)>'
    from <gem-root>/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:138:in `require'
    from <gem-root>/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:138:in `require_command!'
    from <gem-root>/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:83:in `server'
    from <gem-root>/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from <gem-root>/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
    from <rails-root>/bin/rails:9:in `require'
    from <rails-root>/bin/rails:9:in `<top (required)>'
    from <gem-root>/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
    from <gem-root>/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
    from <gem-root>/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
    from <gem-root>/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
    from <gem-root>/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
    from <gem-root>/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
    from <gem-root>/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
    from /Users/rpatterson/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/rpatterson/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from <rails-root>/bin/spring:15:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'
like image 71
Ryan Patterson Avatar answered Jan 26 '23 23:01

Ryan Patterson


I have same issue it seems.

I found this one, which might be relevant -- Difficulty with activesupport when attempting to deploy -- I've tried it but it did not worked for me. In my case 1.8 gems/tools got mingled with 1.9 so I've done more serious cleanup.

Check if you have multiple ruby installs by running which -a ruby and which -a rake and which -a rails. Tidy things up, so that you're using single ruby/bundler/rails combo. I've removed ruby 1.8 completely and left only 1.9 ruby on my system. Then I have cleaned all the gems in the system, and re-run the bundler. I am still missing something, because rake and rails continue to complain about bigdecimal/util

like image 43
marni Avatar answered Jan 26 '23 21:01

marni