"Uh-oh! Unable to start site" on macOS with Local 5.4.1

Hi I’m getting an error message when trying to start up my site:

Error: TypeError: Cannot red property '0' of undefined
at PhpService.get configVariables [as configVariables] (/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+6/lib/PhpService.js:110:75)
at ConfigTemplateService.<<anonymous> (/Applications/Local.app/Contents/Resources/app.asar/main/sites/ConfigTemplatesService.js:1:4014)
at Generator.next (<anonymous>)
at _0x178bd4 (/Applications/Local.app/Contents/Resources/app.asar/main/sites/ConfigTemplatesService.js:1:1385)

It was running fine until today. Any help would be great

Hi @DavidRobinson98,

Sorry for the hiccup! What version of Local are you running?

Hi Clay, it’s version 5.4.1. I updated it recently, would the update have caused an issue?

There’s a possibility since there were changes in Local 5.3.3 to the PHP services to support 64-bit binaries on Windows.

It might be worth testing a quick downgrade to Local 5.3.1 which can be downloaded here: Local 5.3.1

Please let me know if that helps!

Hi Clay no unfortunately that didn’t work. Any other suggestions? I’m on a mac btw
just in case that makes any difference.

Other sites I have in Local are working so it’s specific to this one site.

Got it!

It looks like the port allocation for MailHog went missing which subsequently is causing PHP to not start. Thanks for the stack trace from the log.

If you don’t mind, can you share your ~/Library/Application Support/Local/sites.json file with me via e-mail? I’m curious to see the state that the ports property is in. My e-mail is clay@getflywheel.com.

Once we know the structure, we can devise a solution from there!

OK have done Clay

1 Like

Hi Clay,

Thanks for sending the revised sites.json file through but unfortunately it’s still not opening.

I’m wondering if it’s easier to just copy the enlighten site onto a fresh site? My problem there is that I also can’t seem to access the database with sequel pro. It’s odd as until now I’ve had no issues on Local. Any advice or other options to try out would be great.

Hi David,

Thanks for the follow-up! Copying the site to another site is the best workaround for now as long as you have the site files and an SQL dump


For posterity and other readers:

After reviewing David’s sites.json, the ports property for the individual site services on some sites became an empty object ({}), which will cause the site startup to fail due to not having any allocated ports.

With the missing ports, the sites.json looked something like the following:

"SITEID": {
    ...
    "services": {
        "mailhog": {
            "ports": {},
            "type": "lightning",
            "version": "1.0.0"
        },
        ...
    }
    ...
}

Rather than…

"SITEID": {
    ...
    "services": {
        "mailhog": {
            "ports": {
                "WEB": [
                    10000
                ],
                "SMTP": [
                    10001
                ]
            },
            "type": "lightning",
            "version": "1.0.0"
        },
        ...
    }
    ...
}

If copying the site to another site isn’t possible, you can always create a new site and copy the services property from the newly created site over to the new site and then delete the new site.

Since this is such a tedious task and a complete work-stopper, I have prioritized this bug and have devised a fix. It should be available in the next Local Beta (and subsequently Local) release.

Hi Clay,

Just a quick update to explain the workaround I found. I couldn’t open the database so was looking at having to redo s lot of work. However after reading something on the forum about exporting the site, I right clicked on the site and most of the options were greyed out including export, but there was an option to Clone the site. I gave that a whirl and the cloned site opened up fine. I just had to update the version of PHP it was running as it was throwing up an error message but other than that it was a very quick fix.

Hope this helps anyone else who runs into this issue.

2 Likes

Great, thanks for sharing!

The fix I was talking about is now available in Releases - Local. :slight_smile:

1 Like

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