Could not update hosts file/missing hosts entry

Issue Summary

One or two sentence summary of the issue.
asks for admin privilege’s and gives an error could not update hosts file. It also tells me missing C++ 2015-2019 redistributables depedency.

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular?

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    Site doesn’t get created until I close and reopen local but I can’t access it at all in browser and get an error upon trying to start site.


Describe the steps that others can take to replicate this issue. If you have screenshots that can help clarify what is happening, please include them!
Click start site and get error messages.

System Details

  • Which version of Local is being used?

  • What Operating System (OS) and OS version is being used?

    • For example: macOS Catalina or Windows 10 Professional
      windows 10
  • Attach the Local Log. See this Help Doc for instructions on how to do so:

Hi there @Crockoclock - welcome to the Local community! :wave:

Do you have anti-virus software installed on your computer that may be causing issues?

Here is some information and troubleshooting steps you can try related to anti-virus + Windows:

Let’s start there!

I only have windows anti-virus and I tried disabling it but it still didn’t work

Hi @Crockoclock

I’m not familiar with that error, but doing some Googling it seems pretty common. There are lots of videos and articles that might help you resolve it like these:

After that let us know if your Local issues persist, and if they do please share an updated Log. Retrieving Local’s Log File

I tried it but still doesn’t work. It says its missing still and then I get another error about not being able to update host files. It was says it’s requesting admin privileges but It never pops up.
local-lightning.log (171.8 KB)

Hi @Crockoclock if Local is still unable to update the hosts file there could still be a program or application causing a conflict.

Are you running other developer applications simultaneously? That could also cause similar issues. Apps like MAMP, XAMPP, or Docker for example.

Do you have any antivirus, security, or firewall applications that could be blocking Local?

More details about troubleshooting this here: Router Mode

I don’t have any of those applications installed. I did have xampp a few weeks ago but I uninstalled it.

I tried disabling windows defender which is all I have for anti-virus but that didn’t work either.

I also tried changing the router mode to localhost and it works now. What are the differences between the router modes? Would it effect anything if I want to connect to wp engine eventually?

Hi @Crockoclock

If it’s working normally with Router Mode enabled then that indicates something was indeed creating a conflict with Local. It could have been something leftover from XAMPP, or something still running security interference.

You’re totally safe to develop in LocalHost mode. Some features like Live Links won’t work in this mode but the site can be pushed to WP Engine, however when you’re ready.

If you want to get Site Domains working again you can use some of the troubleshooting steps on that document linked above in order to help investigate any lingering port conflicts.

I removed xampp but when i go to app and features xampp shows up in the list but when I try to uninstall it I get an error. Could that be causing a problem?

Hi @Crockoclock - It certainly could be. It sounds like it isn’t getting removed/uninstalled fully.

If you aren’t able to figure out how to completely wipe it, you can try at least checking and end any port conflicts using these steps:

  • Stop all sites that are running in Local

  • Force quit Local

  • (If using Mac) Run the command lsof -nP -iTCP -sTCP:LISTEN

  • (If using Windows) Run the command netstat -ano

What you’ll be looking for here is to see when sites are stopped and Local is properly shut down if there are still programs running on ports 80 and 443. These may be conflicting with Local or the system may be reporting Local is still running.

Once you run that command you should see a list of listening ports. If you see a particular program making use of those ports, you can then kill that process by running sudo kill -9 XXX where XXX is the PID number of that process. (On Windows you will use taskkill /F /pid XXX where XXX is the PID number of that process)

After that, you should be able to retry. Keep us posted if you have any questions or continuing issues.

There are also some more details around this and other troubleshooting steps at this link if needed: Stopping Whatever Is Listening On Port 80.


this is an error I got from xampp and I was wondering if that is effecting local too?

i’m not seeing ports 80 or 443 in the list when I run that command

It looks like it could be a conflict between XAMPP and Windows, but Local might be getting restricted in the same way. I searched the error and found this:

If I try to uninstall it through their uninstall program or windows apps and features nothing happens. It won’t let me uninstall it

Correct. I don’t think the problem is XAMPP. You may need to check these two things per that article I linked.

  1. Ensure that your user account has administrator privilege.

  2. Disable UAC (User Account Control) as it restricts certain administrative function needed to run a web server.

My account has admin privileges and I disabled UAC. nothing seems to have changed though

Hi @Crockoclock

It’s tough to say, it seems like there is still some type of permissions issue or security blocker on your machine. Do you have another machine you can attempt to test with? Otherwise, you may need to do some searching and troubleshooting to try and diagnose further what may be causing the problem.

For one last try, since you’ve made a lot of changes and disabled many potentially conflicting things, you could try these steps to do a big refresh:

  • Export any sites that you have on Local and save them to a folder somewhere on your computer.

  • Fully uninstall Local from your computer.

  • Install the latest version of Local on this link.

  • Once installed, please restart the computer.

  • When the computer is restarted and turned on, close any applications that automatically run in the background (AntiVirus, Firewall, and other Developer applications included).

  • Check and see if the issue still persists. If so, please provide us with an updated log. Retrieving Local’s Log File

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.