I am getting an error while creating a ruby on rails project. In command, I created a new project by typing rails new club, then bundle. Now, when I try to create my models and controllers by typing and entering rails g resource Club name, I get this error: superclass mismatch for class StringIO (TypeError).
gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:
in `require': superclass mismatch for class StringIO (TypeError)
I don't even has a class named StringIO, so I'm not sure where it came from.
Try reverting to an earlier version of StringIO
gem install stringio -v 0.1.4
gem uninstall stringio # remove 3.0.0 and 3.0.1
None of the above answers worked for me. What happened for me is that I added gem 'rubocop', '~> 0.67.2', require: false to Gemfile and ran bundle install.
This version of rubocop seems to have installed psych as a dependency and then psych has a dependency on stringio and I, correct me if I'm wrong, that must be conflicting with whatever stringio version is being used by bootsnap.
Anyway, to solve it I just deleted the rubocop line I added to Gemfile and added gem 'rubocop', require: false (which installed the latest rubocop version) then ran bundle install again.
I started getting this error after updating my gems. I tried uninstalling ruby and all my gems, updating rvm, but for me the solution appeared to be updating rubygems.
gem update --system