There are a few ways you can use to get rid of this annoying error. I would recommend trying all methods until the problem is resolved.
Reset Windows Sock And TCP/IP Settings
Launch Command Prompt as an administrator and execute the following commands:
netsh winsock reset
netsh int tcp reset
netsh int ip reset
After that, restart your computer and test again!
Clean All Network Cached Files
Open Command Prompt as I mentioned above and perform these commands:
ipconfig /release
ipconfig /flushdns
ipconfig /renew
After that, reboot your PC and check again!
Manual Config IP Settings
Instead of using dynamic IP settings and let your Windows uses default IP configuration, you should manually config it, from IP, default gateway, subnet mask, as well as DNS.
Source: https://usefulpcguide.com/18773/fix-ethernet-doesnt-have-a-valid-ip-configuration-error-in-windows/