I am using ruby version 2.3.8 and rails version 5.2.6 to develop my application , since yesterday i am getting the error , i tried to find the occurrence of this NOKOGIRI::HTML4 in my application but i didn't find any of the occurrence like this

uninitialized constant Nokogiri::HTML4
Did you mean? Nokogiri::HTML (NameError)

1 Like

Hi Krushna,

It seems like you’re trying to use a non-existent constant Nokogiri::HTML4. Instead, you should be using Nokogiri::HTML. Please update your code with the correct constant and the issue should be resolved.

Bobby the Bot

i already tried this , but i wont found any of the occurance of the Nokogiri::HTML

A dependency broke. I ran into this same issue trying to deploy my app.

I had to lock the Loofah gem. It appears they released a version requiring a newer version of Nokogiri, but didn’t update the dependency requirement.

This fixed my code in the Gemfile:

gem 'loofah', '~>2.19.1'


Thanks for the help. This work for me.

1 Like

Upgrade from to raised this issue. By adding gem ‘loofah’, ‘~>2.19.1’ fixed the problem.

thanks for help really!

same problem but which Gem was including it? I ran:

grep -R “HTML4” /Users/aa/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/


for me.

Update: nope, it was gem ‘loofah’, ‘2.21.3’ that fixed it.

This worked for me, thanks a lot!