Unable to run yarn

Hi, I inherited the website and now when I set up the development on my PC and run yarn build I get this error:

yarn build
yarn run v1.22.22
$ bud clean && bud build
Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'
Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'
D:\Docker\new_project\wp-content\themes\my_theme\node_modules\yoga-layout-prebuilt\yoga-layout\build\Release\nbind.js:53
        throw ex;
        ^

[Error: ENOENT: no such file or directory, open 'D:\Docker\new_project\wp-content\package.json'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'D:\\Docker\\saleh\\wp-content\\package.json'
}

Node.js v18.17.1
error Command failed with exit code 7.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

From what I understand, something with paths is not correct since it loads the package.json from wp-content instead of the theme folder?

Can anyone share an idea on what to try to fix this?
Thank you in advance!

Bud does not have Windows support. You will need to use WSL or upgrade to Sage 11’s Vite configuration.

Thanks!
I already tried WSL, also not working.
Is there a doc how to upgrade?

I don’t believe there’s an upgrade guide for Bud → Vite as it can vastly differ between projects. Some things you’d maybe start with is:

FWIW, Bud definitely works on WSL though. If you post some logs of that, maybe we can help?

Yeah, here is what I have when I run it:

/mnt/d/Docker/saleh/wp-content/themes/saleah$ ls
CHANGELOG.md  app             composer.lock  jsconfig.json      package.json  screenshot.png       theme.json
LICENSE.md    bud.config.mjs  functions.php  node_modules       public        style.css            vendor
README.md     composer.json   index.php      package-lock.json  resources     tailwind.config.cjs  yarn.lock
darko@Dell-Laptop:/mnt/d/Docker/saleh/wp-content/themes/saleah$ yarn build
yarn run v1.22.22
$ bud clean && bud build
Unexpected token '{'
(node:2537) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Type Error: The "chunk" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Error
    at _write (node:internal/streams/writable:482:13)
    at Writable.write (node:internal/streams/writable:510:10)
    at CleanCommand.cleanStorage (file:///mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/@roots/bud/lib/cli/commands/clean.js:60:33)
    at async CleanCommand.runCommand (file:///mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/@roots/bud/lib/cli/commands/clean.js:32:13)
    at async CleanCommand.execute (file:///mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/@roots/bud/lib/cli/commands/base.js:177:13)
    at async CleanCommand.validateAndExecute (/mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/clipanion/lib/advanced/Command.js:73:26)
    at async Cli.run (/mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/clipanion/lib/advanced/Cli.js:222:24)
    at async Cli.runExit (/mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/clipanion/lib/advanced/Cli.js:231:28)
Unexpected token '{'
(node:2554) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Type Error: callback is not a function
    at Configuration.run (file:///mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/@roots/bud-framework/lib/configuration/configuration.js:30:26)
    at file:///mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/@roots/bud-framework/lib/configuration/index.js:14:29
    at Array.map (<anonymous>)
    at Module.process (file:///mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/@roots/bud-framework/lib/configuration/index.js:13:60)
    at Bud.run (file:///mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/@roots/bud-framework/lib/methods/run.js:5:29)
    at BuildCommand.runCommand (file:///mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/@roots/bud/lib/cli/commands/build.base.js:192:24)
    at BuildCommand.execute (file:///mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/@roots/bud/lib/cli/commands/base.js:177:24)
    at async BuildCommand.validateAndExecute (/mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/clipanion/lib/advanced/Command.js:73:26)
    at async Cli.run (/mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/clipanion/lib/advanced/Cli.js:222:24)
    at async Cli.runExit (/mnt/d/Docker/saleh/wp-content/themes/saleah/node_modules/clipanion/lib/advanced/Cli.js:231:28)
Done in 38.97s.

What’s your package.json and the node version running on WSL? You might need to either upgrade dependencies or the latter. One of those (or both) should get it working. Windows is definitely a no go, though. Try to debug the WSL error instead.

I need to go but I will check your reply later. Thank you in advance for any idea you have and for suggestions so far!

 node -v
v22.15.0
{
  "name": "sage",
  "private": true,
  "browserslist": [
    "extends @roots/browserslist-config/current"
  ],
  "engines": {
    "node": ">=16.0.0"
  },
  "scripts": {
    "dev": "bud clean && bud dev",
    "build": "bud clean && bud build",
    "watch": "bud clean && bud dev",
    "translate": "yarn translate:pot && yarn translate:update",
    "translate:pot": "wp i18n make-pot . ./resources/lang/sage.pot --include=\"app,resources\"",
    "translate:update": "for filename in ./resources/lang/*.po; do msgmerge -U $filename ./resources/lang/sage.pot; done; rm -f ./resources/lang/*.po~",
    "translate:compile": "yarn translate:mo && yarn translate:js",
    "translate:js": "wp i18n make-json ./resources/lang --pretty-print",
    "translate:mo": "wp i18n make-mo ./resources/lang ./resources/lang"
  },
  "devDependencies": {
    "@roots/bud": "6.4.5",
    "@roots/bud-tailwindcss": "6.4.5",
    "@roots/sage": "6.4.5"
  },
  "dependencies": {
    "@tailwindcss/forms": "^0.5.3",
    "@tailwindcss/typography": "^0.5.8",
    "masonry-layout": "^4.2.2",
    "mcsub": "^0.1.2",
    "photoswipe": "^5.3.8",
    "scroll-out": "^2.2.12",
    "scrollmagic": "^2.0.8",
    "scrollmagic-plugin-gsap": "^1.0.4",
    "scrollreveal": "^4.0.9",
    "splitting": "^1.0.6",
    "swiper": "^8.4.5",
    "video.js": "^7.20.3"
  }
}

Your Bud is very out of date and for some reason version locked. I’d unlock the old version by reinstalling it with yarn add @roots/bud @roots/bud-tailwindcss @roots/sage --dev.

Not sure if you’ll need to adjust anything in your Bud config.

Thank you for your help.
After a lot of fiddling, I got it running in WSL as root.
The only way to edit the files is using a nano editor in consolde, when assets are compiled, I see one set of files in console, another in VS code, and third one in browser.
Too exhausting, I am not sure it is worth this much efforts.

It sounds like you need to install the WSL extension for VS Code then. All this stuff is pretty streamlined and it is absolutely possible to have a seamless local dev environment on Windows entirely running through WSL. Microsoft has put a good bit of time into it all.

I have WSL extension already installed.
If my understanding is correct, I am not able to access the proxy/dev server when I run yarn dev.
I am not sure if I should mess with this, as the theme itself has hardcoded text and all kinds of junk.
I advised the client to plan rebuilding.

Thank you so much for your help.