https://github.com/GetPublii/Publii/issues/652
Also check the above link and try any of the solutions.
None of the solutions worked for me when i faced the JavaScript issue. The only solution worked for me was the “don’t create desktop shortcut” uncheck while installing publii.. but unfortunately not working for you.
I had tried the stack overflow link by Tom, but did not help me. Hope it helps you
Good luck ????