Vendor.js 404 error


I’m getting an error that vendor.js can not be found:

/dist/scripts/vendor.js net::ERR_ABORTED 404 (Not Found)

Any idea why and how to solve it?

I’m also seeing this error. It triggered a lot of 404s on the server which locked my client out :frowning:

The vendor.js file is generated during development builds, but not in production. However, the wp_enqueue_scripts action in app/setup.php still has it as a dependency… something is not quite right there.

1 Like

I ran into similar issues with a couple production sites.

What I found is that it was 100% related to my deployment workflow, specifically rebuilding the acorn config cache. This is pretty much 100% undocumented, so I just had to figure it out.

What worked for me was logging into my production/staging server shell, navagating to the /web directory, and then running wp acorn cache:clear. Sometimes I run all the acorn :clear commands because my server has odd caching behavior (caching the cache!). You can also regenerate the cache on the production server afterwards using other acorn commands.

Not sure if that’s what’s happening for you, but for me, that fixed the relative paths. I plan to build the acorn commands into my pipeline, when I finally have the time. :slight_smile:

@raffjones it looks like that it shouldn’t be loaded on production
@evankford unfortunately that’s not working for me

You can use aliases for WP CLI btw (@development, @production, @staging, etc.),
and it will SSH and cd automatically.

wp @production acorn cache:clear

There’s an issue in the repo with a potential solution:

You can also check for the existence of it with asset('scripts/vendor.js')->exists() if you wanted to write some conditionals.

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