Building project with Docker gets stuck at transforming
Environment
- Operating System: Linux
- Node Version: v22.11.0
- Nuxt Version: 3.16.2
- CLI Version: 3.24.1
- Nitro Version: 2.11.8
- Package Manager: [email protected]
- Builder: -
- User Config: compatibilityDate, devtools, css, modules
- Runtime Modules: @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected]
- Build Modules: -
Is this bug related to Nuxt or Vue?
Nuxt
Version
v3.16.2
Reproduction
https://github.com/GlitchDevX/nuxt-docker-build
GitHub Actions: Working Example Stuck Example
Description
I was trying to create a dockerfile being able to build the complete project without any extra commands to execute beforehand. To do that I tried using a node image as base of the builder part of my multipart dockerfile.
In the building process the npm ci command is executed correctly. However npm run generate or npm run build will get stuck at the transforming step.
I pinned the issue down to the tailwindcss import in the main.css as explained in the nuxt ui starter guide. As when this import is commented out the build will succeed without any issues.
I already tried using different node base images, but it didn't change anything.
Additional context
With tailwindcss import:
Without tailwindcss import:
I created a branch for the minimally changed version without the tailwind css for easier switching in the reproduction repo.
Logs
Hi @GlitchDevX. I have the same issue. Did you found a solution ?
Hey @julbd, unfortunately not. I don't have any idea on how to debug this problem, as it has to do something with the Tailwind CSS import when transforming the project.
I had the same problem, I was using Bun to build the project. I had to switch to pnpm only in the Dockerfile to get the build to go smoothly without getting stuck in the loop.
@zAlweNy26 I am using pnpm 10.10.0
I had the same problem, I was using Bun to build the project. I had to switch to pnpm only in the Dockerfile to get the build to go smoothly without getting stuck in the loop.
Thanks for the hint, I will try it on a branch in the reproduction project.
@zAlweNy26 I am using pnpm 10.10.0
I'm using 9.15.9, I don't know if downgrading could help. I hope this issue get fixed also for Bun, as I'm using it for development.
With DEBUG=true I have the following :
=> => # ℹ transforming...
=> => # [40.56ms] [@tailwindcss/vite] Generate CSS (build)
=> => # [12.45ms] ↳ Setup compiler
=> => # [26.56ms] ↳ Setup scanner
Then it is stuck with exactly 100% cpu usage.
Also, I have this issue only with DOCKER_DEFAULT_PLATFORM="linux/x86_64". Building for arm64 works without any issue.
Update : fixed by disabling Rosetta for x86_64/amd64 emulation on Apple Silicon like described in https://github.com/tailwindlabs/tailwindcss/issues/17728#issuecomment-2884340873
@zAlweNy26 suggested to use pnpm. So I've created a new branch in my reproduction repo using pnpm, however I can't get the nuxt build working without using --shamefully-hoist even outside the docker context.
Inside the docker context (using the parameter) it still gets stuck at the transforming step. Am I missing something?
Here are the links to the new reproduction: GH Action Build Branch
@GlitchDevX
If you're using pnpm, ensure that you either set shamefully-hoist=true in your .npmrc file or install tailwindcss in your project's root directory. https://ui.nuxt.com/getting-started/installation/nuxt
I fixed this problem for myself a week ago: Check if you have recursive classes (endless loops)
I had something like this:
.ui-class {
.dark,
&--dark {
@extend .ui-class;
}
}
Okay I was able to get it working, but found even weirder behavior. The command pnpm generate will only work when executed with a custom build output dir.
So it works when I execute the build inside the docker build with this command:
RUN pnpm generate -- result
# or any other directory name
# you'd also need to change the copy statement to
COPY --from=builder result/.output/public /usr/share/nginx/html
But not like this:
RUN pnpm generate
I've created another reproduction branch here: GitHub Action Branch
Hi! 👋 This issue was automatically closed due to inactivity. If it's still relevant with the latest Nuxt UI version, feel free to reopen or create a new issue.