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
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.
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
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ā.
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.
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.)
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.
@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).
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
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: