Target class [assets.manifest] does not exist - Acorn v3

I am having a problem after upgrading to Acorn v3.

I am using Sage with latest bud.

Error:

image

I have followed the upgrading guide: Upgrading Acorn | Acorn Docs | Roots

Can anyone help? can provide more information.

image

wp acorn
Fatal error: Uncaught ReflectionException: Class “view” does not exist

Fixed by removing config folder from the theme folder.

I have encountered this error when the theme wasn’t built yet (npm run build).

I’m only encountering this issue now while deploying.
I followed the upgrading guide for Acorn v3 and updated all composer dependencies.

In my build-after.yml deploy-hook I run wp acorn optimize:

- name: Run Acorn optimize
  command: wp acorn optimize
  args:
    chdir: "{{ deploy_helper.new_release_path }}"

But that results in the following Class "assets.manifest" does not exist error:

Fatal error: Uncaught ReflectionException: Class "assets.manifest" does not exist in /srv/www/mydomain.com/current/vendor/illuminate/container/Container.php:889
Stack trace:
#0 /srv/www/mydomain.com/current/vendor/illuminate/container/Container.php(889): ReflectionClass->__construct('assets.manifest')
#1 /srv/www/mydomain.com/current/vendor/illuminate/container/Container.php(770): Illuminate\Container\Container->build('assets.manifest')
#2 /srv/www/mydomain.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(860): Illuminate\Container\Container->resolve('assets.manifest', Array, true)
#3 /srv/www/mydomain.com/current/vendor/illuminate/container/Container.php(706): Illuminate\Foundation\Application->resolve('assets.manifest', Array)
#4 /srv/www/mydomain.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(845): Illuminate\Container\Container->make('assets.manifest', Array)
#5 /srv/www/mydomain.com/current/vendor/roots/acorn/src/Illuminate/Foundation/helpers.php(120): Illuminate\Foundation\Application->make('assets.manifest', Array)
#6 /srv/www/mydomain.com/current/vendor/roots/acorn/src/Roots/helpers.php(21): app('assets.manifest')
#7 /srv/www/mydomain.com/current/web/app/themes/sage/app/setup.php(173): Roots\asset('editor.css')
#8 /srv/www/mydomain.com/current/web/wp/wp-includes/class-wp-hook.php(308): App\{closure}('')
#9 /srv/www/mydomain.com/current/web/wp/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#10 /srv/www/mydomain.com/current/web/wp/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#11 /srv/www/mydomain.com/current/web/wp/wp-settings.php(595): do_action('after_setup_the...')
#12 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1336): require('/srv/www/cms.cl...')
#13 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1254): WP_CLI\Runner->load_wordpress()
#14 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#15 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#16 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#17 phar:///usr/bin/wp/php/boot-phar.php(11): include('phar:///usr/bin...')
#18 /usr/bin/wp(4): include('phar:///usr/bin...')
#19 {main}

Next Illuminate\Contracts\Container\BindingResolutionException: Target class [assets.manifest] does not exist. in /srv/www/mydomain.com/current/vendor/illuminate/container/Container.php:891
Stack trace:
#0 /srv/www/mydomain.com/current/vendor/illuminate/container/Container.php(770): Illuminate\Container\Container->build('assets.manifest')
#1 /srv/www/mydomain.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(860): Illuminate\Container\Container->resolve('assets.manifest', Array, true)
#2 /srv/www/mydomain.com/current/vendor/illuminate/container/Container.php(706): Illuminate\Foundation\Application->resolve('assets.manifest', Array)
#3 /srv/www/mydomain.com/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(845): Illuminate\Container\Container->make('assets.manifest', Array)
#4 /srv/www/mydomain.com/current/vendor/roots/acorn/src/Illuminate/Foundation/helpers.php(120): Illuminate\Foundation\Application->make('assets.manifest', Array)
#5 /srv/www/mydomain.com/current/vendor/roots/acorn/src/Roots/helpers.php(21): app('assets.manifest')
#6 /srv/www/mydomain.com/current/web/app/themes/sage/app/setup.php(173): Roots\asset('editor.css')
#7 /srv/www/mydomain.com/current/web/wp/wp-includes/class-wp-hook.php(308): App\{closure}('')
#8 /srv/www/mydomain.com/current/web/wp/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#9 /srv/www/mydomain.com/current/web/wp/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#10 /srv/www/mydomain.com/current/web/wp/wp-settings.php(595): do_action('after_setup_the...')
#11 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1336): require('/srv/www/cms.cl...')
#12 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1254): WP_CLI\Runner->load_wordpress()
#13 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#14 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#15 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#16 phar:///usr/bin/wp/php/boot-phar.php(11): include('phar:///usr/bin...')
#17 /usr/bin/wp(4): include('phar:///usr/bin...')
#18 {main}
  thrown in /srv/www/mydomain.com/current/vendor/illuminate/container/Container.php on line 891

In my app/setup.php file I have this on line 75:

use function Roots\asset;

add_action('after_setup_theme', function () {
	....
	add_editor_style(asset('editor.css')->uri());
}, 20);

If I comment that line and deploy again, it goes fine.
When I manually uncomment that line on the remote server, the editor.css file is enqueued correctly, so it only happens while deploying?

I tried calling instead:

add_editor_style(\Roots\asset('editor.css')->uri());

But same result, can I not use the Roots\asset class anymore in Acorn 3?
When I var_dump the function call elsewhere in my template, it outputs the uri correctly?

var_dump(asset('editor.css')->uri())

Any thoughts?

EDIT: The error also occurs when running wp @development acorn optimize locally.

If you have config files published to your site, it looks like you’ll need to copy over the changes from the latest config:

https://github.com/roots/acorn/blob/f482856aaf4c80a4baa7ccf62c23d9d8597681f3/config/app.php

I’ll get the guide updated with this

I did by running:

wp @development acorn acorn:init storage && wp @development acorn vendor:publish --tag=acorn

That copied all the new config files to my theme’s config folder.

1 Like

I can’t tell if you mean that you’re sorted out or not by this response. Are you still hitting the error?

My apologies :slight_smile:
I meant I copied over the changes from the latest config by running that command, so my config files are up-to-date, but I’m still hitting that error.

And that’s only happening on a Trellis deploy and not on your local dev? If so, can you try manually removing the framework/cache directory on the server to see if that works?

The default location is at app/cache/acorn/framework/cache/

Also, running wp acorn vendor:publish --tag=acorn results in skipping copying over any changes to those files if they already exist (it should say that in the terminal) — you will have to manually copy over the changes. You should see a diff similar to this for config/app.php:

--- a/config/app.php
+++ b/config/app.php
@@ -1,5 +1,7 @@
 <?php
 
+use Illuminate\Support\Facades\Facade;
+
 use function Roots\env;
 
 return [
@@ -123,6 +125,24 @@
 
     'cipher' => 'AES-256-CBC',
 
+    /*
+    |--------------------------------------------------------------------------
+    | Maintenance Mode Driver
+    |--------------------------------------------------------------------------
+    |
+    | These configuration options determine the driver used to determine and
+    | manage Laravel's "maintenance mode" status. The "cache" driver will
+    | allow maintenance mode to be controlled across multiple machines.
+    |
+    | Supported drivers: "file", "cache"
+    |
+    */
+
+    'maintenance' => [
+        'driver' => 'file',
+        // 'store'  => 'redis',
+    ],
+
     /*
     |--------------------------------------------------------------------------
     | Autoloaded Service Providers
@@ -137,31 +157,32 @@
     'providers' => [
 
         /*
-         * Laravel Framework Service Providers...
+         * Framework Service Providers...
          */
-        // Illuminate\Auth\AuthServiceProvider::class,
-        // Illuminate\Broadcasting\BroadcastServiceProvider::class,
+        Illuminate\Auth\AuthServiceProvider::class,
+        Illuminate\Broadcasting\BroadcastServiceProvider::class,
         Illuminate\Bus\BusServiceProvider::class,
         Illuminate\Cache\CacheServiceProvider::class,
-        // Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
-        // Illuminate\Cookie\CookieServiceProvider::class,
-        // Illuminate\Database\DatabaseServiceProvider::class,
-        // Illuminate\Encryption\EncryptionServiceProvider::class,
-        Illuminate\Filesystem\FilesystemServiceProvider::class,
-        // Illuminate\Foundation\Providers\FoundationServiceProvider::class,
-        // Illuminate\Hashing\HashServiceProvider::class,
-        // Illuminate\Mail\MailServiceProvider::class,
-        // Illuminate\Notifications\NotificationServiceProvider::class,
-        // Illuminate\Pagination\PaginationServiceProvider::class,
-        // Illuminate\Pipeline\PipelineServiceProvider::class,
-        // Illuminate\Queue\QueueServiceProvider::class,
-        // Illuminate\Redis\RedisServiceProvider::class,
-        // Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
-        // Illuminate\Session\SessionServiceProvider::class,
-        // Illuminate\Translation\TranslationServiceProvider::class,
-        // Illuminate\Validation\ValidationServiceProvider::class,
-        Illuminate\View\ViewServiceProvider::class,
+        Illuminate\Cookie\CookieServiceProvider::class,
+        Illuminate\Database\DatabaseServiceProvider::class,
+        Illuminate\Encryption\EncryptionServiceProvider::class,
+        Illuminate\Hashing\HashServiceProvider::class,
+        Illuminate\Mail\MailServiceProvider::class,
+        Illuminate\Notifications\NotificationServiceProvider::class,
+        Illuminate\Pagination\PaginationServiceProvider::class,
+        Illuminate\Pipeline\PipelineServiceProvider::class,
+        Illuminate\Queue\QueueServiceProvider::class,
+        Illuminate\Redis\RedisServiceProvider::class,
+        Illuminate\Routing\RoutingServiceProvider::class,
+        Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
+        Illuminate\Session\SessionServiceProvider::class,
+        Illuminate\Translation\TranslationServiceProvider::class,
+        Illuminate\Validation\ValidationServiceProvider::class,
+        Roots\Acorn\Assets\AssetsServiceProvider::class,
+        Roots\Acorn\Filesystem\FilesystemServiceProvider::class,
         Roots\Acorn\Providers\AcornServiceProvider::class,
+        Roots\Acorn\Providers\RouteServiceProvider::class,
+        Roots\Acorn\View\ViewServiceProvider::class,
 
         /*
          * Package Service Providers...
@@ -185,48 +206,8 @@
     |
     */
 
-    'aliases' => [
-
-        'App' => Illuminate\Support\Facades\App::class,
-        'Arr' => Illuminate\Support\Arr::class,
-        'Artisan' => Illuminate\Support\Facades\Artisan::class,
-        'Auth' => Illuminate\Support\Facades\Auth::class,
-        'Blade' => Illuminate\Support\Facades\Blade::class,
-        'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
-        'Bus' => Illuminate\Support\Facades\Bus::class,
-        'Cache' => Illuminate\Support\Facades\Cache::class,
-        'Config' => Illuminate\Support\Facades\Config::class,
-        'Cookie' => Illuminate\Support\Facades\Cookie::class,
-        'Crypt' => Illuminate\Support\Facades\Crypt::class,
-        'Date' => Illuminate\Support\Facades\Date::class,
-        'DB' => Illuminate\Support\Facades\DB::class,
-        'Eloquent' => Illuminate\Database\Eloquent\Model::class,
-        'Event' => Illuminate\Support\Facades\Event::class,
-        'File' => Illuminate\Support\Facades\File::class,
-        'Gate' => Illuminate\Support\Facades\Gate::class,
-        'Hash' => Illuminate\Support\Facades\Hash::class,
-        'Http' => Illuminate\Support\Facades\Http::class,
-        'Js' => Illuminate\Support\Js::class,
-        'Lang' => Illuminate\Support\Facades\Lang::class,
-        'Log' => Illuminate\Support\Facades\Log::class,
-        'Mail' => Illuminate\Support\Facades\Mail::class,
-        'Notification' => Illuminate\Support\Facades\Notification::class,
-        'Password' => Illuminate\Support\Facades\Password::class,
-        'Queue' => Illuminate\Support\Facades\Queue::class,
-        'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
-        'Redirect' => Illuminate\Support\Facades\Redirect::class,
-        // 'Redis' => Illuminate\Support\Facades\Redis::class,
-        'Request' => Illuminate\Support\Facades\Request::class,
-        'Response' => Illuminate\Support\Facades\Response::class,
-        'Route' => Illuminate\Support\Facades\Route::class,
-        'Schema' => Illuminate\Support\Facades\Schema::class,
-        'Session' => Illuminate\Support\Facades\Session::class,
-        'Storage' => Illuminate\Support\Facades\Storage::class,
-        'Str' => Illuminate\Support\Str::class,
-        'URL' => Illuminate\Support\Facades\URL::class,
-        'Validator' => Illuminate\Support\Facades\Validator::class,
-        'View' => Illuminate\Support\Facades\View::class,
-
-    ],
+    'aliases' => Facade::defaultAliases()->merge([
+        // 'ExampleClass' => App\Example\ExampleClass::class,
+    ])->toArray(),
 
 ];

No it’s also happening locally when I run wp @development acorn optimize, I just didn’t noticed it until deploying.

Yeah it did prompt me if I wanted to overwrite and I did.
I don’t see any differences between the:

and my config/app.php

I’m trying to understand what’s going on.

Did you already have the config/ folder published prior to upgrading Acorn v3? If so, there should absolutely be the changes as noted in my last message. Those changes should fix the error for Target class [assets.manifest] does not exist.

Yes, the config folder was already in place prior to updating containing the Acorn v2 config files along with my acf & poet config files.

After I run the command:

wp @development acorn acorn:init storage && wp @development acorn vendor:publish --tag=acorn

The config files got updated and I committed the changes to my repo.
I also deleted the app/cache folder.

Everything works fine after this, except when deploying since that runs wp acorn optimize.
I can reproduce this by running wp @development acorn optimize locally.

I also ran yarn build to re-build my assets and I can see the manifest exists.

The only way that I can reproduce the Target class [assets.manifest] does not exist error is by using Acorn v3 with the Acorn v2 config/app.php file :confused:

:face_in_clouds:
It’s only happening when I use the \Roots\asset function though, the \Roots\bundle function works without the assets.manifest error?

1 Like

Sorry about that, my mistake! I’m able to reproduce with adding the asset function and then running wp acorn optimize

Reported at https://github.com/roots/acorn/issues/263

2 Likes

No worries, I’m glad I’m not doing anything wrong this time :smile:
Thanks!

1 Like

Fixed with Release v3.0.1 · roots/acorn · GitHub - thank you for bringing this to our attention!

1 Like