LoadError: cannot load such file -- i18n/core_ext/hash

488 views Asked by At

I am working on multiple projects, when I switch from one project to another, compile the assets using:

➜ rails assets:precompile

Ruby: 2.7.5 Rails: 6.0

What I get is:

/Users/luqman/.rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/net-protocol-0.2.1/lib/net/protocol.rb:68: warning: previous definition of ProtocRetryError was here
/Users/luqman/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/protocol.rb:206: warning: already initialized constant Net::BufferedIO::BUFSIZE
/Users/luqman/.rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/net-protocol-0.2.1/lib/net/protocol.rb:214: warning: previous definition of BUFSIZE was here
/Users/luqman/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/protocol.rb:503: warning: already initialized constant Net::NetPrivate::Socket
/Users/luqman/.rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/net-protocol-0.2.1/lib/net/protocol.rb:541: warning: previous definition of Socket was here
rails aborted!
LoadError: cannot load such file -- i18n/core_ext/hash
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:324:in `block in require'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:324:in `require'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/chewy-7.1.0/lib/chewy.rb:17:in `<main>'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/luqman/Desktop/techdots-projects/ccc/config/application.rb:7:in `<main>'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/luqman/Desktop/techdots-projects/ccc/Rakefile:4:in `<main>'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:22:in `block in perform'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/railties-6.0.6.1/lib/rails/command.rb:48:in `invoke'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/railties-6.0.6.1/lib/rails/commands.rb:18:in `<main>'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/luqman/.rvm/gems/ruby-2.7.5/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)

The problem seems to be of the i18n gem. I have even tried updating the bundler. But still getting this issue.

Even running the full trace doesn't gives me anything.

The i18n gem used is -> i18n (>= 0.7, < 2)

The chewy gem seems to be a problem

/Users/luqman/.rvm/gems/ruby-2.7.5/gems/chewy-7.1.0/lib/chewy.rb:17:in'`

1

There are 1 answers

0
Burhan Gardezi On

So got it fixed by cleaning all the global and local gems by using: gem uninstall -aIx

Created gemsets for each project and separate gems for each project. Bundle install all the gems.

The problem here was some gems were conflicting. Even on removing the gems, it wasn't being removed completely.

I hope this helps!