Target class [sage.view] does not exist!

Effectively a duplicate of this issue:

I set up a Sage 10.5.1 theme, with Acorn V3 as well as attempted installs with V3.1 and V2.X…I have the following Symfony exception on the frontend :

Target class [sage.view] does not exist.

It seems to be due to the following declaration in [theme-name]/index.php :

<div id="app">
  <?php echo view(app('sage.view'), app('sage.data'))->render(); ?>
</div>

Is it a wrong config of my theme or local environment ?

I precise I’m .running my local env via a Docker setup with DDEV on WSL2, I’m normally respecting all needed config (PHP version…etc…). I installed Acorn via the plugin in Wordpress backoffice.

Thank you for any help !

Any FSE/Gutenberg in that Sage theme? I encountered this error message, and in my case there was a theme.json and the required FSE templates in templates/, but remove_theme_support('block-templates'); was still used in the theme. This caused a contradictory state: FSE is enabled, but block templates feature is not.

Have you followed the recommendations in that thread?
Specifically, have you referenced this PR to make certain your theme is compatible with Acorn v3?

1 Like

@Galiro do you have the themes/yourtheme/storage/framework and themes/yourtheme/storage/logs directories?

I didn’t use the CLI method of installing Sage which I think creates these dirs and I got the same errors.

1 Like

I have exactly the same issue, I’m not able to resolve it.
I’ve also checked all the files to be compatible with Acorn 3.1. Everything seems oke.

Has there been any solution to this? I’m having the same issue but none of the fixes in that PR have worked. I’m on V3.1, ThemeServiceProvider file is correct according to the upgrade guide as is the functions.php file. At a bit of a loss with it as everything I’m finding says that it should work. Where is the sage.view file actually located? Might try to create manually and see if that works

@RobHowdle are you updating a theme or is this a new sage & acorn installation?

Apologies for the late reply. This is a brand new installation. In my old role we used Sage 9 but I wanted to try Sage 10.

@RobHowdle it’s probably helpful to provide more context. What does your dev environment look like? Is this a bedrock installation? What directory did you install acorn in?

Using a simple lamp stack on Ubuntu, nothing fancy. Standard Wordpress installation with sage 10, installing acorn inside of the theme I created

I don’t usually use standard wp installations, but I just spun one up as a test using Laravel Valet and am not able to replicate this issue.

Here’s the order I installed and the specs of my dev environment in case that’s helpful:

  • create standard wordpress installation
  • php version for my environment is 8.0
  • install sage via composer
  • use volta to install and pin node to lts version (18.16.0)
  • composer install roots/acorn from my theme directory
  • update .setPublicPath and .proxy to match my local dev url and path
  • run yarn && yarn build from my theme
  • activate sage theme
2 Likes

@RobHowdle - did you try the above?

1 Like

There is an upgrade guide, I think I saw the error there: Upgrading Acorn | Acorn Docs | Roots