Unable to Start Sites

What issue or error are you experiencing?

Since I changed my site path to an external drive, if i restart Local (or reboot my Mac) i get an error starting sites

TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at PortsService.<anonymous> (/Applications/Local.app/Contents/Resources/app.asar/main/sites/PortsService.js:1:2282)
at Generator.next (<anonymous>)
at /Applications/Local.app/Contents/Resources/app.asar/main/sites/PortsService.js:1:330
at new Promise (<anonymous>)
at __awaiter (/Applications/Local.app/Contents/Resources/app.asar/main/sites/PortsService.js:1:75)
at PortsService.checkAndReplaceUnavailablePorts (/Applications/Local.app/Contents/Resources/app.asar/main/sites/PortsService.js:1:2148)
at SiteProcessManagerService.<anonymous> (/Applications/Local.app/Contents/Resources/app.asar/main/sites/SiteProcessManagerService.js:63:2772)
at Generator.next (<anonymous>)
at n (/Applications/Local.app/Contents/Resources/app.asar/main/sites/SiteProcessManagerService.js:1:132)

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc


System Details

  • Local Version:
    Version 9.0.5+6706

  • Operating System (OS) and OS version:
    Apple M1
    Sequoia 15.0.1


Local Logs

Attach your Local Logs here (Help Doc - Retrieving Localā€™s Log)
local-lightning.log (704.2 KB)


Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however thereā€™s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isnā€™t private info like passwords being displayed.

@jon_stormbox Are you able to create a new site and access that? Iā€™m just curious if the switch is only impacting sites you were previously working on or any sites at all.

Yes able to create new sites, just cannot load existing sites so have to delete them and spin up a new site, or pull again from WPE

If you can create and access new sites okay, then you may want to try reimporting any getting the errors. The steps would look like this:

  • Locate the site files on your machine, and save a copy of them to your desktop. If you click Go to Site Folder under your site name it should take you right to where they are located.
  • Once you have those copied, completely delete the site from Local
  • Restart Local/your machine
  • Reimport the site back into Local. You can refer here on how to Restore from only Local site files

Correct, that is what I do, but next time I quit Local (reboot machine) I have to do it all again, and it is a PITA as I have to redownload theme files as well as git files do not get pushed/pulled to WPE.

So yes I have a work around, but to do this for 20+ sites every time I reboot is not a fix

One potential issue since you mentioned switching to an external drive is that when Local starts/runs, the drive isnā€™t being mounted @jon_stormbox, but based on what we are seeing in your logs, it seems like there might also be a corrupt site entry in there with a broken/missing port. To look into this further, could you share a copy of your sites.json file?

On macOS the steps would look like this

  • Open the Finder.
  • Choose Go ā†’ Go To Folder
  • Paste ~/Library/Application Support/Local and press Enter
  • sites.json will appear in that folder. Go to step 2 below.
  • Make a backup of the sites.json file

For example, duplicate it as ā€œsites-backup.jsonā€.

Sure here is the json

I have deleted all sites and re-downloaded (WPE) or spun up new ones previously, so all sites are fresh, and have the same problem

[link downloaded and removed by WPE support]

Thanks for sharing your sites.json and sorry that you ran into this, @jon_stormbox.

Some of your sites (e.g. ā€œLeaflet Mapsā€, ā€œWP Reset Themeā€) are missing ports for the mailpit service:

      "mailpit": {
        "name": "mailpit",
        "version": "1.12.1",
        "type": "lightning"
      },

Other sites (that I would expect should run without error, such as one starting ā€œpiaraā€) look like this:

      "mailpit": {
        "name": "mailpit",
        "version": "1.12.1",
        "type": "lightning",
        "ports": { "WEB": [10027], "SMTP": [10037] }
      },

Local includes logic to repair missing ports to try to prevent the error from your original screenshot. That repair process is working well for me when I test it locally (I can remove ports and theyā€™re restored just fine when I start sites), so I havenā€™t been able to reproduce the issue youā€™re seeing yet and I canā€™t find other reports of this so far.

You mentioned it started when you switched to an external drive.

  1. If you use your main hard drive instead of the external drive, does everything work smoothly for you? (Just wondering if the drive could be sleeping or otherwise not persistently available to write to.)
  2. Is there anything different about the sites Iā€™ve named above that are missing ports? (For example, did you import them or otherwise create them in a different way?)

Thanks for your help exploring potential causes here.

@nickc

The port numbers have always been sequential for all my web sites.

Site 1: 10000-10004
Site 2: 10005-10009
Site 3: 10010-10014
Site 4: 10015-10019
Site 5: 10020-10024
etc.

But the last site I created with Local 9.1.1 didnā€™t follow this logic?

So it looks weird with the port numbers 10027 and 10037 above.

I also face this issue.

@emmtre Thanks for the observation! Assigned ports depend on whatā€™s available on each system, so slightly higher (or uneven) port numbers alone arenā€™t unusual. Missing port numbers are, though ā€” once a service has run once successfully its ports should all be assigned.

@manasa Sorry to hear that, feel free to share more information (logs, are you running from an external drive, screenshots of any errors).

1 Like

I think I may have found what the issue was. The hard drive was plugged into a dock due to lack of usb-c/thunderbolt ports on my mac mini.

I have plugged directly into the mac now and it looks like I have been able to shut down over the weekend and start my sites.

As for the mailpit issue, I always get the ā€œMissing Mailpitā€ error that say it will resolve on start up. It is always there though, even after starting sites
Screenshot 2024-12-03 at 8.59.55 am

1 Like

Thanks for sharing your solution, @jon_stormbox, good to hear you can now restart sites! It sounds like the drive was either sleeping or perhaps not consistently getting the power it needed via the hub.

To clear the Mailpit banner, you can try the steps in this post:

1 Like