Error when using 'yarn bud clean' after upgrade to 6.3.0 (from 6.2.0)

I now get this error when running lando yarn bud clean

Type Error: Cannot read properties of undefined (reading 'dir')
    at factory (file:///app/web/app/themes/my-theme/node_modules/@roots/bud/lib/factory/index.js:24:49)
    at CleanCommand.execute (file:///app/web/app/themes/my-theme/node_modules/@roots/bud/lib/cli/commands/clean.js:11:26)
    at CleanCommand.validateAndExecute (/app/web/app/themes/my-theme/node_modules/clipanion/lib/advanced/Command.js:73:37)
    at /app/web/app/themes/my-theme/node_modules/clipanion/lib/advanced/Cli.js:222:53
    at noopCaptureActivator (/app/web/app/themes/my-theme/node_modules/clipanion/lib/advanced/Cli.js:448:12)
    at Cli.run (/app/web/app/themes/my-theme/node_modules/clipanion/lib/advanced/Cli.js:222:30)
    at Cli.runExit (/app/web/app/themes/my-theme/node_modules/clipanion/lib/advanced/Cli.js:231:39)
    at bud (file:///app/web/app/themes/my-theme/node_modules/@roots/bud/lib/cli/index.js:54:17)
error Command failed with exit code 1.

My public path is set as follows in bud.config.js:

.setPublicPath('/app/themes/my-theme/public/')

Could this be related to how the public path is handled in the newest version?

1 Like

Can confirm!

On the plus side, you can just remove --clean. It will clean for you now (when doing production builds).

1 Like

Ah perfect! Thank you

One more question that may or may not be related to the above:

(lando) yarn dev seems to run fine, but on localhost I get this 404 error:

GET http://0.0.0.0:3000/js/app.js Not found

(edit: correct path)

This is my bud.config.js (working on 6.2.0)

/**
 * @typedef {import('@roots/bud').Bud} bud
 *
 * @param {bud} app
 */
module.exports = async (app) => {
  app

    .entry({
      app: ['@scripts/app', '@styles/app'],
      editor: ['@scripts/editor', '@styles/editor'],
    })

    .setPublicPath('/app/themes/my-theme/public/')

    .assets(['images', 'fonts'])

    .watch(
      'resources/views/**/*',
      'resources/scripts/**/*', // Added this, otherwise HMR doesn't work with scripts
      'app/**/*',
      'tailwind.config.js'
      )

    .serve('http://0.0.0.0:3000');
};

quickest fix is to run yarn bud etc. outside of the container, since the disk is shared between host and docker. If you run yarn bud dev on your machine instead of in lando you will be able to access your site in dev using localhost.

I’m not 100% on all the intricacies of networking with lando but I think what you’re bumping into is that lando is a containerized process. So, localhost within the container is different than the localhost outside of it. lando has its own way of mapping your host requests to the container, so you’ll probably end up wanting/needing to go with that flow (use the .lndo domain, etc.)

0.0.0.0 is kind of special, and is accessible both from the host and the container… and why bud uses it as a default network address. but, It is not localhost, despite frequently resolving to the same place.

Sorry I can’t be of more help. There are other posts in the discourse by people using lando who know way more than me.

1 Like
1 Like

Thanks for your answer kellymears

Darn I was happy to finally have achieved a working lando setup, oh well… Hopefully there is a simple solution

I tried yarn bud dev but that doesn’t work outside the container in my current configuration.

I guess I am going to have to fiddle with my lando config or wait till someone comes up with a solution. Or fall back to the browsersync plugin. For the time being I will revert back to 6.2.0

Edit: see (temporary) solution here Bud 6.3.0 issues with 404s

I am confident 6.3.2 will solve your issue @cim.

sorry for breaking your install. we have e2e tests for both acorn v2 & v3 now.