Yarn dev sometimes assumes Bedrock

We’re not using Bedrock for new builds anymore and have gone back to a traditional Wordpress installation approach, however sometimes when starting yarn dev for the day none of the assets will load and it appears they’re looking for app/themes/ instead of wp-content/themes/

This is on new builds that have never seen Bedrock in the dev container.

Restarting yarn dev usually fixes it after one or two tries.

Anyone ran into this? What’s the fix?

As of bud 6.12.0, the build cache is [os-cache dir]/bud-nodejs/[hash of project path].

If that directory is somehow shared between dev container instances, you may experience what you describe.

Running yarn dev --force will force Bud to invalidate the cache, and rebuild everything.

It is not, it’s a generic LAMP container that has no site directory at all when its initialized. So strange. Actually don’t even know if we’ve used Bedrock in anything since switching to these.

I’m just going to update my yd alias to do yarn dev --force for now then so it invalidates it every time.

That’s very odd. Will be interesting to see if --force fixes the issue.

You can always run yarn run bud repl and then bud.path("@os-cache") to check the cache location. This is usually inside the user’s $HOME, not necessarily the site directory / workspace mount.

The “path” argument must be of type string. Received undefined

Not sure if I needed to enter more than just bud.path("@os-cache")

Edit: Which version of bud are you running?

Here’s example output I’ve just taken from my terminal:

devspace ./theme-name $ yarn run bud repl
yarn run v1.22.19
$ /app/web/app/themes/theme-name/node_modules/.bin/bud repl

                                                                                                                                                                                                                                                                                                                                                                                                                page 1/1

[esc] quit  [tab] clear  [↓] next  [↑] prev  [return] eval

6.8.0 currently

./theme-name $ yarn run bud repl                                                                                                                                                                                                                                                                                                                                                                     

                                                                                                                                                                                                                                                                                                                                                                                                             page 1/1
The "path" argument must be of type string. Received undefined

Did you have to manually cd somewhere once inside of repl? I don’t get that one line of output containing the node_modules and full site path.

Your bud version doesn’t use an @os-cache location.

There has been a lot of great development since 6.8.0. Are you able to update to the latest 6.12.x?

1 Like

Probably, I only installed this Sage 10 site last Monday, I wonder why it would come with such outdated dependencies lol

Okay I ran through yarn interactive-upgrade and bumped sage, roots-bud, and roots-budtailwindcss to 6.12.2.

Went through the whole install guide last week and for some reason that only gave me 6.8.0

1 Like

Brilliant. I hope that properly fixes your problem (and possibly even your other issue with HMR).

The main sage branch has been updated to bud 6.12.2, but no release yet. I’m sure the Roots team have their reasons for that, and I expect we will see a new minor Sage release in the next month or so.