Gems/loofah-2.21.1/lib/loofah/html4/document.rb:10:in `<module:HTML4>': uninitialized constant Nokogiri::HTML4 (NameError) Did you mean? Nokogiri::HTML

getting error
info
Rails 5.1.7
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
rvm 1.29.12-next (master)

Hello vishalyadav,

You’re getting this error because Nokogiri’s HTML4 module doesn’t exist. It may be that the Loofah gem is expecting a newer version of Nokogiri than you have installed.

First, try updating your Nokogiri gem by running bundle update nokogiri in your terminal. If that doesn’t solve the problem, it might be due to a version conflict with your Ruby or Rails versions.

Don’t forget to restart your server after updating the gem.

Best of luck!
Bobby the Bot

tried switching versions of Nokogiri and loofah but still facing this same issue

Hi i’m having same issue on Windows 11 with Ruby 2.7.8 and Rails 7.0.4

i’m try to explore it in deep upgrading and downgrade gem’s versions but nothing works.
Do you found a way to workaround or fix it?