Argument 1 passed to Roots\Acorn\Assets\Manager::manifest() must be of the type string, null given error

Hello,

First of all, loving Sage, awesome stuff :slight_smile:

But recently I have encountered a problem which left me completely stuck, screenshot: https://nimb.ws/eV84HR

Here’s a publicly accessible link: https://exfactory.invsbl.lt/

This error has come up in few projects (both sage10 + BR) in my local environment (Valet on MacOS) after adding a package via Composer. The public link is a Plesk server, so the problem doesn’t seem to be my local environment.

First project crashed after https://github.com/generoi/sage-woocommerce
Second https://wordpress.org/plugins/spatie-ray/

Although I’m pretty sure packages themselves are not to blame. Also, both projects were just started and had almost none custom functionality. Interestingly, in neither cases, it was a first installed package, everything was working fine for a while and after adding a 4th plugin, things just stopped working.

If I comment out script enqueueing function, the error disappears:

add_action('wp_enqueue_scripts', function () {
    wp_enqueue_script('sage/vendor.js', asset('scripts/vendor.js')->uri(), ['jquery'], null, true);
    wp_enqueue_script('sage/app.js', asset('scripts/app.js')->uri(), ['sage/vendor.js'], null, true);
wp_add_inline_script('sage/vendor.js', asset('scripts/manifest.js')->contents(), 'before');

    if (is_single() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }

    wp_enqueue_style('sage/app.css', asset('styles/app.css')->uri(), false, null);
}, 100);

I would appreciate any help, thanks a lot.

Also, here’s composer.json if that’s any help

{
  "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": "^7.3|^8.0",
    "generoi/sage-woocommerce": "^0.1.4",
    "roots/acorn": "2.0.0-alpha.0"
  },
  "require-dev": {
    "filp/whoops": "^2.12",
    "squizlabs/php_codesniffer": "^3.6"
  },
  "suggest": {
    "log1x/sage-directives": "A collection of useful Blade directives for WordPress and Sage (^1.0).",
    "log1x/sage-svg": "A useful SVG directive for inlining SVG's within Blade views (^1.0)."
  },
  "config": {
    "optimize-autoloader": true,
    "preferred-install": "dist",
    "sort-packages": true
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "scripts": {
    "lint": [
      "phpcs --extensions=php --standard=PSR12 app config"
    ],
    "post-autoload-dump": [
      "Roots\\Acorn\\ComposerScripts::postAutoloadDump"
    ]
  }
}

What’s on line 17 of your setup.php?

It’s the first wp_enqueue_script function in this action:

add_action('wp_enqueue_scripts', function () {
wp_enqueue_script('sage/vendor.js', asset('scripts/vendor.js')->uri(), ['jquery'], null, true);
wp_enqueue_script('sage/app.js', asset('scripts/app.js')->uri(), ['sage/vendor.js'], null, true);

wp_add_inline_script(‘sage/vendor.js’, asset(‘scripts/manifest.js’)->contents(), ‘before’);

if (is_single() && comments_open() && get_option('thread_comments')) {
    wp_enqueue_script('comment-reply');
}

wp_enqueue_style('sage/app.css', asset('styles/app.css')->uri(), false, null);

}, 100);

It’s something with asset() function, I’ve temporary replaced it and everything’s working well:

    // wp_enqueue_script('sage/vendor.js', asset('scripts/vendor.js')->uri(), ['jquery'], null, true);
wp_enqueue_script('sage/vendor.js', get_template_directory_uri() . "/public/scripts/vendor.js", ['jquery'], null, true);

// wp_enqueue_script('sage/app.js', asset('scripts/app.js')->uri(), ['sage/vendor.js'], null, true);
wp_enqueue_script('sage/app.js', get_template_directory_uri() . "/public/scripts/app.js", ['sage/vendor.js'], null, true);

This topic was automatically closed after 42 days. New replies are no longer allowed.