Fatal error: Uncaught Error: Call to a member function boot() on null in

I’m trying to build my first project with sage (10), I’m running a local xampp server on windows 10 the PHP version of xampp is 8.1.6. When I try to activate the theme after installing Acorn, I get the following fatal error:

Fatal error: Uncaught Error: Call to a member function boot() on null in .../functions.php on line *43*

Which is this line:

\Roots\bootloader()->boot();

I did find a similar topic here https://discourse.roots.io/t/fatal-error-after-fresh-install-sage-10-acorn-3-2/25549, but I don’t have any plugins or modifications. My guess is that it might be the PHP version not being 8.2? Is there a Sage 10 version that supports 8.16 so that I can test?

Thanks

I managed to solve it by uploading acorn as a plugin (php 8.0) and changing the bootloader from: \Roots\bootloader()->boot(); to \Roots\bootloader();

1 Like

Please, @Broder explain your solution.

I tried a fresh installation of Sage 10 (with Bedrock) and I got the same error, using PHP 8.2.11. I’m also using Windows 10, but my project is running on WSL Ubuntu.

What do you mean by “uploading acorn as a plugin”? I installed Acorn with composer at the WordPress level. Do I need to install it on the Sage theme folder?

Thanks in advance.

Hi @jerasokcm, my solution was to download acorn as a plugin (uninstall your current version first) from GitHub - roots/acorn: Laravel components for WordPress plugins and themes and upload it to your plugins folder (mu-plugins is probably better, but didn’t do that). Activate the plugin and it should give you a different error. This is due to the version of Acorn plugin being 2, so you need to change the bootloader function call in functions.php. Hope this works for you!

@jerasokcm Acorn should be installed at the theme directory, maybe thats why its not working. I also switched to wsl and it works fine following the documentation

Thanks, @Broder . I will give it a try.

1 Like

To avoid confusion, I just want to add that it’s not quite true that Acorn should be installed at the theme directory. Acorn can be installed in the theme directory, but if using Bedrock, you probably want it installed at the project level to avoid conflicts with other dependencies.

1 Like

Thanks for clarifying