Search code examples
ruby-on-railsrubycommand-linerubygems

why all of my Gem commands are suddenly not working?


I started receiving the following every time i wanted to write any gem command:

Traceback (most recent call last):
8: from C:/Ruby25-x64/bin/gem:9:in `<main>'
7: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
6: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
5: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/gem_runner.rb:86:in `<top (required)>'
4: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems.rb:1140:in `load_plugins'
3: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems.rb:556:in `find_latest_files'
2: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:1156:in `latest_specs'
1: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:1173:in `_latest_specs'
C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:1173:in `sort_by': comparison of Array with String failed (ArgumentError)

Solution

  • I solved the issue. I was actually learning ruby on rails and to cope with the course I started a new rails application with MySQL and started a rails server in the root of the project however it didn't work because it wasn't able to locate the gem. One of the solutions I found online was to edit the MySQL .gemspec file however it made things worse and suddenly no gem command was running anymore. I solved the issue by uninstalling ruby and then installing it again and also installing the gems again (including rails)