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!
/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.
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.