'Uncaught TypeError: Cannot set properties of null (setting 'innerHTML') - react app hosting

I have problem with hosting my website in react. I choose hostinger, but when I upload my all files and add file ‘.htaccess’, I see in Console something like this:

Uncaught TypeError: Cannot set properties of null (setting 'innerHTML') at (index):416:27

(..)    
<script>
    var pathName = window.location.hostname;
    var account = document.getElementById("pathName");
    var accountText = document.getElementById("website");
    account.innerHTML = pathName;
    accountText.innerHTML = pathName; //in this line I can see error 'pathName' is highlight
</script>
</body>

</html>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source