Error on main with manifest

Hello,

I have installed latest main and have an error. Vite doesn’t create manifests? Or is a bad path? Because I use only sage without bedrock.

Fatal error: Uncaught Roots\Acorn\Assets\Exceptions\ManifestNotFoundException: The asset manifest [/app/wp-content/themes/webgravity/public/build/manifest.json] cannot be found. in /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Roots/Acorn/Assets/Manager.php:122 Stack trace: #0 /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Roots/Acorn/Assets/Manager.php(95): Roots\Acorn\Assets\Manager->getJsonManifest('/app/wp-content...') #1 /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Roots/Acorn/Assets/Manager.php(71): Roots\Acorn\Assets\Manager->resolve('theme', Array) #2 /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Roots/Acorn/Assets/AssetsServiceProvider.php(27): Roots\Acorn\Assets\Manager->manifest('theme') #3 /app/wp-content/themes/webgravity/vendor/illuminate/container/Container.php(937): Roots\Acorn\Assets\AssetsServiceProvider->Roots\Acorn\Assets\{closure}(Object(Roots\Acorn\Application), Array) #4 /app/wp-content/themes/webgravity/vendor/illuminate/container/Container.php(819): Illuminate\Container\Container->build(Object(Closure)) #5 /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(1051): Illuminate\Container\Container->resolve('assets.manifest', Array, true) #6 /app/wp-content/themes/webgravity/vendor/illuminate/container/Container.php(755): Illuminate\Foundation\Application->resolve('assets.manifest', Array) #7 /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(1033): Illuminate\Container\Container->make('assets.manifest', Array) #8 /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Illuminate/Foundation/helpers.php(124): Illuminate\Foundation\Application->make('assets.manifest', Array) #9 /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Roots/helpers.php(17): app('assets.manifest') #10 /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Roots/globals.php(6): Roots\asset('images/firmy/in...') #11 /app/wp-content/cache/acorn/framework/views/69c1c30833576d225c4446ac4b578d42.php(34): asset('images/firmy/in...') #12 /app/wp-content/themes/webgravity/vendor/illuminate/filesystem/Filesystem.php(123): require('/app/wp-content...') #13 /app/wp-content/themes/webgravity/vendor/illuminate/filesystem/Filesystem.php(124): Illuminate\Filesystem\Filesystem::Illuminate\Filesystem\{closure}() #14 /app/wp-content/themes/webgravity/vendor/illuminate/view/Engines/PhpEngine.php(58): Illuminate\Filesystem\Filesystem->getRequire('/app/wp-content...', Array) #15 /app/wp-content/themes/webgravity/vendor/illuminate/view/Engines/CompilerEngine.php(75): Illuminate\View\Engines\PhpEngine->evaluatePath('/app/wp-content...', Array) #16 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(209): Illuminate\View\Engines\CompilerEngine->get('/app/wp-content...', Array) #17 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(192): Illuminate\View\View->getContents() #18 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(161): Illuminate\View\View->renderContents() #19 /app/wp-content/cache/acorn/framework/views/3ebff0b223b6700c27c82541f46a7dde.php(9): Illuminate\View\View->render() #20 /app/wp-content/themes/webgravity/vendor/illuminate/filesystem/Filesystem.php(123): require('/app/wp-content...') #21 /app/wp-content/themes/webgravity/vendor/illuminate/filesystem/Filesystem.php(124): Illuminate\Filesystem\Filesystem::Illuminate\Filesystem\{closure}() #22 /app/wp-content/themes/webgravity/vendor/illuminate/view/Engines/PhpEngine.php(58): Illuminate\Filesystem\Filesystem->getRequire('/app/wp-content...', Array) #23 /app/wp-content/themes/webgravity/vendor/illuminate/view/Engines/CompilerEngine.php(75): Illuminate\View\Engines\PhpEngine->evaluatePath('/app/wp-content...', Array) #24 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(209): Illuminate\View\Engines\CompilerEngine->get('/app/wp-content...', Array) #25 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(192): Illuminate\View\View->getContents() #26 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(161): Illuminate\View\View->renderContents() #27 /app/wp-content/themes/webgravity/index.php(3): Illuminate\View\View->render() #28 /app/wp-includes/template-loader.php(106): include('/app/wp-content...') #29 /app/wp-blog-header.php(19): require_once('/app/wp-include...') #30 /app/index.php(17): require('/app/wp-blog-he...') #31 {main} Next Illuminate\View\ViewException: The asset manifest [/app/wp-content/themes/webgravity/public/build/manifest.json] cannot be found. (View: /app/wp-content/themes/webgravity/resources/views/partials/front-page/logos.blade.php) in /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Roots/Acorn/Assets/Manager.php:122 Stack trace: #0 /app/wp-content/themes/webgravity/vendor/illuminate/view/Engines/PhpEngine.php(60): Illuminate\View\Engines\CompilerEngine->handleViewException(Object(Roots\Acorn\Assets\Exceptions\ManifestNotFoundException), 3) #1 /app/wp-content/themes/webgravity/vendor/illuminate/view/Engines/CompilerEngine.php(75): Illuminate\View\Engines\PhpEngine->evaluatePath('/app/wp-content...', Array) #2 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(209): Illuminate\View\Engines\CompilerEngine->get('/app/wp-content...', Array) #3 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(192): Illuminate\View\View->getContents() #4 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(161): Illuminate\View\View->renderContents() #5 /app/wp-content/cache/acorn/framework/views/3ebff0b223b6700c27c82541f46a7dde.php(9): Illuminate\View\View->render() #6 /app/wp-content/themes/webgravity/vendor/illuminate/filesystem/Filesystem.php(123): require('/app/wp-content...') #7 /app/wp-content/themes/webgravity/vendor/illuminate/filesystem/Filesystem.php(124): Illuminate\Filesystem\Filesystem::Illuminate\Filesystem\{closure}() #8 /app/wp-content/themes/webgravity/vendor/illuminate/view/Engines/PhpEngine.php(58): Illuminate\Filesystem\Filesystem->getRequire('/app/wp-content...', Array) #9 /app/wp-content/themes/webgravity/vendor/illuminate/view/Engines/CompilerEngine.php(75): Illuminate\View\Engines\PhpEngine->evaluatePath('/app/wp-content...', Array) #10 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(209): Illuminate\View\Engines\CompilerEngine->get('/app/wp-content...', Array) #11 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(192): Illuminate\View\View->getContents() #12 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(161): Illuminate\View\View->renderContents() #13 /app/wp-content/themes/webgravity/index.php(3): Illuminate\View\View->render() #14 /app/wp-includes/template-loader.php(106): include('/app/wp-content...') #15 /app/wp-blog-header.php(19): require_once('/app/wp-include...') #16 /app/index.php(17): require('/app/wp-blog-he...') #17 {main} Next Illuminate\View\ViewException: The asset manifest [/app/wp-content/themes/webgravity/public/build/manifest.json] cannot be found. (View: /app/wp-content/themes/webgravity/resources/views/partials/front-page/logos.blade.php) (View: /app/wp-content/themes/webgravity/resources/views/partials/front-page/logos.blade.php) in /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Roots/Acorn/Assets/Manager.php:122 Stack trace: #0 /app/wp-content/themes/webgravity/vendor/illuminate/view/Engines/PhpEngine.php(60): Illuminate\View\Engines\CompilerEngine->handleViewException(Object(Illuminate\View\ViewException), 1) #1 /app/wp-content/themes/webgravity/vendor/illuminate/view/Engines/CompilerEngine.php(75): Illuminate\View\Engines\PhpEngine->evaluatePath('/app/wp-content...', Array) #2 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(209): Illuminate\View\Engines\CompilerEngine->get('/app/wp-content...', Array) #3 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(192): Illuminate\View\View->getContents() #4 /app/wp-content/themes/webgravity/vendor/illuminate/view/View.php(161): Illuminate\View\View->renderContents() #5 /app/wp-content/themes/webgravity/index.php(3): Illuminate\View\View->render() #6 /app/wp-includes/template-loader.php(106): include('/app/wp-content...') #7 /app/wp-blog-header.php(19): require_once('/app/wp-include...') #8 /app/index.php(17): require('/app/wp-blog-he...') #9 {main} thrown in /app/wp-content/themes/webgravity/vendor/roots/acorn/src/Roots/Acorn/Assets/Manager.php on line 122

If you use only sage, without bedrock, you should set path started with /wp-content/, eg.:
base: '/wp-content/themes/your-theme-name/public/build/',


I had it set, but its not working.

Ok, as I invastigated it’s not problem with base path. Path starts with /app/ because of using Lando. On previous version of sage is working good.

Summary:

  • I use only sage (no bedrock)
  • I downloaded sage main branch today because I wanted to use tailwind v4
  • I use Lando
  • Manifest is not generating when run dev
  • when run dev got error: yarn run v1.22.22
    $ vite
    node:fs:2345 return binding.writeFileUtf8( ^Error: ENOENT: no such file or directory, open ‘public/hot’
  • If I create public folder manually error disappears, but manifest is not generated
  • assets (images, fonts) are cloned to public/build/assets, but when use asset() got wrong url

I have no idea whats wrong :slight_smile:

Maybe still too early to use dev version of sage & acron?

In your description above I don’t see run build. You might need to run that first to generate the manifest

run dev doesn’t generate manifest? :open_mouth:

I attach vite config, manifest.json (which is generated only in run build), and error in console because image is 404.

Zrzut ekranu 2025-02-4 o 13.52.31

On run dev:

Try using {{ Vite::asset() }} to access your hashed images.

This was suggested by @cspicuzza in the roots discord

Unfortunately not working… :frowning: Still the same errors

I just did a quick test setup using a standard wp project. This is what worked for me:

  • Edit vite.config.js
    base: '/wp-content/themes/sage/public/build/'

  • Add a .env at the root directory of the theme and set the local dev url as the app path:
    APP_URL=https://example.test

    (edit) I initially did this step to resolve a console warning that I thought would prevent HMR from working. It turned out to be unnecessary so I think it’s best to skip this unless absolutely necessary.

  • Add an image to my resources/images directory

  • Run npm run build command

  • Add this to a view:
    <img src="{!! Vite::asset('resources/images/logo.svg') !!}" alt="">

  • Run npm run dev

2 Likes

Works! thanks :slight_smile:

I have not set APP_URL, and Vite::asset should have “resources”

I’m seeing the same error too, even after adding .env with APP set to my local url.
I installed Sage dev-main.
I installed node dependencies and built my project. Everything appears to be generated.
After building my site, I visit the url (https://mysite.local) and get:
It looks like it’s prepending app/public to my base url. Is that correct?
/Volumes/Evo/Local/sage/app/public/wp-content/themes/fourblock-theme/public/manifest.json

Now if I run npm run dev first and visit https://mysite.local there’s no error – it works.
However, when accessing the dev url that it returns after running npm run dev, http://localhost:5173/wp-content/themes/sage/public/build/, I get a Laravel Vite screen instead of my site running in dev mode.

My composer:

{
  "name": "roots/sage",
  "type": "wordpress-theme",
  "license": "MIT",
  "description": "WordPress starter theme with a modern development workflow",
  "homepage": "https://roots.io/sage/",
  "authors": [
    {
      "name": "Ben Word",
      "email": "ben@benword.com",
      "homepage": "https://github.com/retlehs"
    },
    {
      "name": "Scott Walkinshaw",
      "email": "scott.walkinshaw@gmail.com",
      "homepage": "https://github.com/swalkinshaw"
    },
    {
      "name": "QWp6t",
      "email": "hi@qwp6t.me",
      "homepage": "https://github.com/qwp6t"
    },
    {
      "name": "Brandon Nifong",
      "email": "brandon@tendency.me",
      "homepage": "https://github.com/log1x"
    }
  ],
  "keywords": [
    "wordpress"
  ],
  "support": {
    "issues": "https://github.com/roots/sage/issues",
    "forum": "https://discourse.roots.io/"
  },
  "autoload": {
    "psr-4": {
      "App\\": "app/"
    }
  },
  "require": {
    "php": ">=8.2",
    "roots/acorn": "^5.0@beta"
  },
  "require-dev": {
    "laravel/pint": "^1.20"
  },
  "suggest": {
    "log1x/sage-directives": "A collection of useful Blade directives for WordPress and Sage (^1.0)."
  },
  "config": {
    "optimize-autoloader": true,
    "preferred-install": "dist",
    "sort-packages": true
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "scripts": {
    "post-autoload-dump": [
      "Roots\\Acorn\\ComposerScripts::postAutoloadDump"
    ]
  }
}

First, I figured out the development issues. The reason is, Brave browser was blocking the CSS file from loading which is odd.
But, now there’s no dev issues. Visiting my local site (https://mysite.local), I get HMR.

However, after building my project then visiting the same url (https://mysite.local), I still get that error: **Fatal error** : Uncaught Roots\Acorn\Assets\Exceptions\ManifestNotFoundException about the asset manifest can’t be found.
BTW, I dumped the Acorn cache too before I rebuilt.

Error:

Fatal error: Uncaught Roots\Acorn\Assets\Exceptions\ManifestNotFoundException: The asset manifest [/Volumes/Evo/Local/sage/app/public/wp-content/themes/sage/public/manifest.json] cannot be found. in /Volumes/Evo/Local/sage/app/public/wp-content/themes/sage/vendor/roots/acorn/src/Roots/Acorn/Assets/Manager.php

Vite config:

import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite';
import laravel from 'laravel-vite-plugin'
import { wordpressPlugin, wordpressThemeJson } from '@roots/vite-plugin';

export default defineConfig({
  base: '/wp-content/themes/sage/public/build/',
  plugins: [
    tailwindcss(),
    laravel({
      input: [
        'resources/css/app.css',
        'resources/js/app.js',
        'resources/css/editor.css',
        'resources/js/editor.js',
      ],
      refresh: true,
    }),

    wordpressPlugin(),

    // Generate the theme.json file in the public/build/assets directory
    // based on the Tailwind config and the theme.json file from base theme folder
    wordpressThemeJson({
      disableTailwindColors: false,
      disableTailwindFonts: false,
      disableTailwindFontSizes: false,
    }),
  ],
  resolve: {
    alias: {
      '@scripts': '/resources/js',
      '@styles': '/resources/css',
      '@fonts': '/resources/fonts',
      '@images': '/resources/images',
    },
  },
})
1 Like

@djmtype You need to be using dev-main for Acorn right now, not the v5 beta

1 Like

@ben Thanks! Total oversight on my part.

1 Like