Oryx icon indicating copy to clipboard operation
Oryx copied to clipboard

Hugo build fails: POSTCSS: failed to transform "main.css" / uv_os_homedir returned ENOENT

Open dagholmus opened this issue 3 years ago • 0 comments

Bug Report

  • At what date and time did you most recently experience the problem?

Today.

  • Where did you experience the problem? E.g. Azure Web Apps, Azure Functions, Azure Container Registry, or offline use.

Azure Web Apps

  • If your repo is publicly available please share its URL:

https://github.com/dagholmus/test-doks (brand new clone of the theme, with the same deploy error)

  • What happened?

I'm having some issues deploying a Hugo site, with the theme Doks to Static Web Apps. The theme contains npm modules, with package.json.

Build/deploy works both locally and to Netlify, but not to Azure Static Web Apps.

Error message:

POSTCSS: failed to transform "main.css" ... A system error occurred: uv_os_homedir returned ENOENT (no such file or directory)

I have tried the following:

  • Add CUSTOM_BUILD_COMMAND / PRE_BUILD_COMMAND in environemnt to install postcss-cli (and postcss, @fullhuman/postcss-purgecss, autoprefixer)
  • Set HOME and HOMEPATH in environment
  • Added the npm install postcss-cli command (tested both local and global) in the GitHub workflow file (.yml)
  • Tested different versions of Node and Hugo
  • Specifying Hugo version in workflow config
  • Tested to use npm run build instead of the default Hugo

  • What did you expect or want to happen?

To build and deploy the site.

  • How can we reproduce it?

Build and deploy Hugo with the Doks theme to Azure Static Web Apps.

  • Do you have log output? Please include between the backticks:
> @hyas/[email protected] build
> exec-bin node_modules/.bin/hugo/hugo --gc --minify

Start building sites … 
hugo v0.101.0-466fa43c16709b4483689930a4f9ac8add5c9f66+extended linux/amd64 BuildDate=2022-06-16T07:09:16Z VendorInfo=gohugoio
Total in 927 ms
Error: Error building site: POSTCSS: failed to transform "main.css" (text/css): SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_homedir returned ENOENT (no such file or directory)
    at Object.<anonymous> (/opt/nodejs/17.6.0/lib/node_modules/npm/node_modules/clean-stack/index.js:6:61)
    at Module._compile (node:internal/modules/cjs/loader:[109](https://github.com/dagholmus/test-doks/actions/runs/3142773746/jobs/5106761354#step:4:110)7:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/opt/nodejs/17.6.0/lib/node_modules/npm/node_modules/aggregate-error/index.js:3:20)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)


---End of Oryx build logs---
Oryx has failed to build the solution.

dagholmus avatar Sep 28 '22 10:09 dagholmus