How I fixed my luci.ucodebridge error

After fiddling around in LuCI (OpenWrt 23.05.0-rc3) I managed to get myself to the point where I would see the login screen but immediately after logging in, received this error:

Error
Unhandled exception during request dispatching
module 'luci.ucodebridge' not found:
	no field package.preload['luci.ucodebridge']
	no file './luci/ucodebridge.lua'
	no file '/usr/share/lua/luci/ucodebridge.lua'
	no file '/usr/share/lua/luci/ucodebridge/init.lua'
	no file '/usr/lib/lua/luci/ucodebridge.lua'
	no file '/usr/lib/lua/luci/ucodebridge/init.lua'
	no file './luci/ucodebridge.so'
	no file '/usr/lib/lua/luci/ucodebridge.so'
	no file '/usr/lib/lua/loadall.so'
	no file './luci.so'
	no file '/usr/lib/lua/luci.so'
	no file '/usr/lib/lua/loadall.so'

In [anonymous function](), file [C]

In [anonymous function](), file /usr/share/ucode/luci/runtime.uc, line 133, byte 10:
  called from function [arrow function] (/usr/share/ucode/luci/runtime.uc:141:63)
  called from function render ([C])
  called from function [anonymous function] (/usr/share/ucode/luci/runtime.uc:141:64)
  called from function run_action (/usr/share/ucode/luci/dispatcher.uc:778:34)
  called from function [anonymous function] (/usr/share/ucode/luci/dispatcher.uc:998:48)
  called from anonymous function (/www/cgi-bin/luci:39:12)

             die(ex);
  Near here --------^

I googled and searched this forum and found many many many people with the same or similar errors but the closest I found to a solution was (unhelpfully) "just factory reset".

Once I got it working again I thought it would be nice to post how I resolved it so that the next person hopefully finds something a bit more useful than "just factory reset" when they have the same problem. Good luck, unknown future person!

I fixed it by SSH-ing into the router and running opkg install luci-app-uhttpd

I don't know why but it works now.