I recently ran a composer update which automatically updated my Acorn version from 4.3.1 to 5.0.0-beta.1, after which point my site started throwing this error. It seems to be a namespacing issue with some of Acorn’s dependencies - vendor/roots/acorn/src/illuminate/Foundation/Exceptions/Renderer/Mappers/BladeMapper.php is attempting to call the once() function, which is defined in vendor/illuminate/support/helpers.php, so based on the error message BladeMapper.php is looking for the function in the wrong namespace. The error isn’t stopping my site from running, but it is preventing any other errors from being displayed when debugging is enabled which isn’t ideal.
I tried to resolve this by downgrading Acorn back to 4.3.1, but I’m also encountering issues getting the downgrade to stick. I’ve tried running composer update while specifying "roots/acorn": "4.3.1" in composer.json, combining the above with composer dump-autoload, and deleting my entire vendor directory before running composer update --no-cache. The result in all of these cases is the output from composer indicating that Acorn 4.3.1 is being installed, but the wp acorn command still indicating I have 5.0.0-beta.1 is being used.
If anyone has any ideas on how to resolve either issue (because they should both fix the underlying problem), I would appreciate you letting me know.
It sounds like you need to composer remove Acorn and re-require it in. Could also try nuking the vendor folder and re-running composer install. It sounds like you possibly have 2 versions installed somehow? Maybe 1 in the theme, 1 in Bedrock?
I’m slightly confused how composer upgrade took you to a major version beta though.
You were correct the issue was because there were two instances of Acorn installed. I had 4.3.1 installed at the site level from when I first set up my site, and unknowingly had 5.0.0-beta.1 at the theme level as well because generoi/sage-woocommerce lists Acorn as a dependency.
After some experimentation, it seems that Composer is currently pulling Acorn 5.0.0-beta.1 as the default because it sees that as the “latest version”, so that’s something for people to be aware of. This is what caused my site to have two different versions, as generoi/sage-woocommerce lists Acorn as a dependency but does not specify a specific version.
I fixed this by uninstalling generoi/sage-woocommerce at the theme level, installing Acorn 4.3.1 at the theme level, and then re-installing generoi/sage-woocommerce at the theme level - I’m aware this isn’t an ideal solution as there are still two instances of Acorn but it’s working for the time being.