Error on fresh install

I created a fresh project (on local by flywheel, Apache, PHP 8.0.22) and installed bedrock, acorn and sage, but when I activate sage I get an error saying “You need to install Acorn to use this theme.”
The output from the error can be seen here: <?phpobject(ParseError)#526 (7) { ["message":protected]=> string(34) "sy -
I can’t see anything that looks off in the file where php sees the error (marked the line with >>>):

     * Searches files and directories which match defined rules.
     * @param string|string[] $dirs A directory path or an array of directories
     * @return $this
     * @throws DirectoryNotFoundException if one of the directories does not exist
    public function in(string|array $dirs): static
        $resolvedDirs = [];

        foreach ((array) $dirs as $dir) {
            if (is_dir($dir)) {
                $resolvedDirs[] = [$this->normalizeDir($dir)];
            } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) {
>>>                $resolvedDirs[] = array_map($this->normalizeDir(...), $glob);
            } else {
                throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));

        $this->dirs = array_merge($this->dirs, ...$resolvedDirs);

        return $this;

Any idea what might be wrong?

You need acorn runtime for Sage 10 themes. You can install it either as composer dependency (recommended) or as a plugin:

Acorn is installed as composer dependency, in fact I first had the same problem when creating a second sage theme inside a bedrock-sage setup, where an earlier version of sage 10 definitely was working. I then updated acorn + deps, as a result the older sage theme stopped working too, with the same error. Only then I tried so set everything up from scratch, with the problem persisting.

The \Roots\bootloader function must be present when the Sage theme loads, as checked here:

So it is not present, something is wrong with the autoloading by composer, as otherwise the check would pass and no such WordPress error caused.

Have you added the recommended post-autoload-dump script to the (theme) composer.json?:

If not, add it, then invoke composer dump-autoload to make that post-dump-autoload script run.
If already added, still invoke composer dump-autoload to see whether this helps.

Sorry, found the problem, was related to being on php 8.0

1 Like

:thinking: Though that issue refers to PHP 8.1 and you encountered to PHP syntax error.
Glad you found the issue. Very arcane and strange issue indeed.