thuliteio/doks

issue with npm run build

Marco5dev opened this issue · 12 comments

everytime i run the npm run build commend i get this error

> jsonverse@1.2.7 build
> exec-bin "node_modules/.bin/hugo/hugo" --minify

Start building sites … 
hugo v0.118.2-da7983ac4b94d97d776d7c2405040de97e95c03d+extended windows/amd64 BuildDate=2023-08-31T11:23:51Z VendorInfo=gohugoio

Total in 2748 ms
Error: error building site: POSTCSS: failed to transform "main.css" (text/css): 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

what should i do to fix it i tried everything nothing works

h-enk commented

Do you have a repo you could share?

Do you have a repo you could share?

yes, I do

you can check it Here https://github.com/Marco5dev/jsonverse-documentation

h-enk commented

You've hit a (known) Hugo issue with mounting data. In short, use the data component folder on project level.

So, put /themes/my-doks-theme/data/docs-versions.yml in /data/ and you should be fine.

Aside) The themes folder structure will be dropped in one of the next releases in favor of using the project-level folders, for that seems more intuitive — and robust

You've hit a (known) Hugo issue with mounting data. In short, use the data component folder on project level.

So, put /themes/my-doks-theme/data/docs-versions.yml in /data/ and you should be fine.

Aside) The themes folder structure will be dropped in one of the next releases in favor of using the project-level folders, for that seems more intuitive — and robust

i did in my local environmet i removed data folder nothing changed
i still keep getting the same error

and i tryed to clone the doks again and after running the npm run dev for the first time without coding and stoped the server, i tried to run npm run build

... and i got the same error

h-enk commented

I cannot reproduce your issue. It works — locally — OK for me:

PS D:\TEST\doks-1096> npm run build && npm run preview

> jsonverse@1.2.7 build
> exec-bin node_modules/.bin/hugo/hugo --minify

Start building sites …
hugo v0.118.2-da7983ac4b94d97d776d7c2405040de97e95c03d+extended windows/amd64 BuildDate=2023-08-31T11:23:51Z VendorInfo=gohugoio


                   | EN
-------------------+-----
  Pages            | 42
  Paginator pages  |  1
  Non-page files   |  0
  Static files     | 84
  Processed images |  0
  Aliases          | 11
  Sitemaps         |  2
  Cleaned          |  0

Total in 1997 ms

> jsonverse@1.2.7 preview
> http-server --gzip --brotli --ext=html --cors

Starting up http-server, serving ./public

I guess your build fails while deploying to GitHub pages — your workflow file is installing Hugo. Don't do that — Hyas does that for you. This is a much simpler, working example workflow file:

https://github.com/h-enk/doks-gh-pages/blob/master/.github/workflows/deploy-github.yml

Aside) I'm working on the new, updated docs — available soon

h-enk commented

What if you run npm run clean:build && npm run build?

What if you run npm run clean:build && npm run build?

image

> jsonverse@0.0.0 clean:build
> shx rm -rf public resources .hugo_build.lock


> jsonverse@0.0.0 build
> exec-bin node_modules/.bin/hugo/hugo --minify

Start building sites …
hugo v0.118.2-da7983ac4b94d97d776d7c2405040de97e95c03d+extended windows/amd64 BuildDate=2023-08-31T11:23:51Z VendorInfo=gohugoio

Total in 2690 ms
Error: error building site: POSTCSS: failed to transform "main.css" (text/css): 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
h-enk commented

You have a local problem.

  • Did you try npm run clean && npm run i && npm run build?
  • Does it work on GitHub pages?

You have a local problem.

  • Did you try npm run clean && npm run i && npm run build?
  • Does it work on GitHub pages?

it worked on github pages right but now well too some pages when you open it's without scss and i fixed something about the versions when i open the versions on the page he give me an error

also when the Github action try to run npm run build i don't see any errors

you made me now start thinking that the problem is on my device

You have a local problem.

  • Did you try npm run clean && npm run i && npm run build?
  • Does it work on GitHub pages?

it worked on github pages right but now well too some pages when you open it's without scss and i fixed something about the versions when i open the versions on the page he give me an error

also when the Github action try to run npm run build i don't see any errors

you made me now start thinking that the problem is on my device

I'm having the same issue.

Error: error building site: POSTCSS: failed to transform "main.css" (text/css): 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

See also: PostCSS does not work in directories with spaces

Thanks! Now it's working perfectly.
Also thanks for this amazing theme.