I have upgraded Acorn v2 to v3 on a sage10 -theme following these instructions: Upgrading Acorn | Acorn Docs | Roots.
Everything works as it should on local development, no problem there. However when I am running the same site on a live server I am getting following error on terminal:
#8 {main}
** thrown in /data/wordpress/htdocs/wp-content/themes/mythemename/functions.php on line 43** Fatal error: Uncaught Error: Call to undefined method Roots\Acorn\Bootloader::boot() in /data/wordpress/htdocs/wp-content/themes/mythemename/functions.php:43
Line 43 in functions.php is:
\Roots\bootloader()->boot();
This causes âcritical errorâ on the website. If i comment out the line 43, I am able to access the wp-admin panel and not getting anymore errors on the server side. However, then I am not able to access the front which gives âThere has been critical errorâ.
The php-error.log then gives undefined function app() in acorn -error:
PHP Fatal error: Uncaught Error: Call to undefined function app() in /data/wordpress/vendor/roots/acorn/src/Roots/helpers.php:37
Any help on pinpointing and solving the problem would be appreciated. Thanks!
Hi @talss89 , sorry for a possibly dumb question but how can I verify if Acorn 3.x is loaded? (I am new to sage10 but have been using sage9 for years so Acorn is new to me).
When i ran âcomposer updateâ it said updated Acorn from v2 to v3.
But when i run some acorn-command, for example âwp acorn envâ I get error âError: âacornâ is not a registered wp command. See âwp helpâ for available commands.
Did you mean âcoreâ?â
On other live server where I have sage10 theme and the acorn works, the âwp acorn envâ -command gives âCurrent application environment: productionâ. This would suggest that your theory about Acorn not loading might be true, but I have no idea how to test that.
For more info, I would imagine that the Acorn IS loaded since if i edit roots/acorn/src/Roots/helpers.php and add wp_die function inside the bootloader() -function, the wp_die() works:
But when I edit the Bootloader.php getInstance() -function that the helpers.php line 51 refers to, it doesnt work. Added wp_die() there but the function doesnt click:
More information about the problem. On three different instances, when using var_dump($bootloader); on helpers.php I get the following (the instance where the Bootloader doestnt work gives different dump than the others), any idea on why this is happening and how can i fix it?
// Other LIVE site, Bootloader works, same response as the local that works
object(Roots\Acorn\Bootloader)#5628 (3) { [âappâ:protected]=> NULL [âbasePathâ:protected]=> NULL [âabsoluteApplicationPathPrefixesâ:protected]=> array(2) { [0]=> string(1) â/â [1]=> string(1) "" } }
Thanks for the info. Letâs ignore the live server that works for the moment to keep things simple.
Iâd try:
Ensuring composer.json and composer.lock are identical between your dev and live environments
Delete vendor/ directory on live environment
Run composer install on live environment
That will ensure youâre installing the same dependencies on live as you are on dev. That will put us in a clean state to diagnose further, if required.
Thanks for the answers, I had tried all of those solutions before and didnt get the site working.
BUT now the site works, the cause for the problem was the type of âhuman errorâ. For some reason I forgot to push some of the Acorn3 -related changes to git from my local development site, so the livesite that was not working was at the same state as the local version.
I just pushed the newest changes to git and pulled them from the live server, and everything is okay