Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo leptos build loads wrong version of the tailwingcss binary #426

Closed
LouneCode opened this issue Jan 29, 2025 · 0 comments · Fixed by #428
Closed

Cargo leptos build loads wrong version of the tailwingcss binary #426

LouneCode opened this issue Jan 29, 2025 · 0 comments · Fixed by #428

Comments

@LouneCode
Copy link

Cargo leptos build loads wrong tailwindcss (v4.0.0) binary

HOST: arm64
Docker image: rust:alpine3.20 - use musl libc

Cargo leptos build loads a wrong tailwindcss binary when building leptos application in the rust:alpine3.20 Docker container (->musl)

Dockerfile:

FROM rust:alpine3.20 AS builder 
...
RUN cargo install --locked cargo-leptos
...
# Set compilation environment 
ENV LEPTOS_TAILWIND_VERSION=${LEPTOS_TAILWIND_VERSION}
#ENV LEPTOS_SASS_VERSION=${LEPTOS_SASS_VERSION}
ENV LEPTOS_WASM_OPT_VERSION=${LEPTOS_WASM_OPT_VERSION}
ENV WASM_BIND_GEN=${WASM_BIND_GEN}
...
RUN cargo leptos build --release -vv
..

Compilation fails when it start process css files. This example has been run many times and the tailwindcss-linux-arm64 binary has been loaded in the first run.

217.4 Tailwind config: TailwindConfig { input_file: "style/tailwind.css", config_file: "tailwind.config.js", tmp_file: "/app/target/tmp/tailwind.css" } 
217.4 Command [tailwindcss] is_force_pin_version: true - Ok("v4.0.0") 
217.4 Command [tailwindcss] checking for the latest available version 
217.4 Style not configured 217.6 Command [tailwindcss] requested version v4.0.0 is already same or newer than available version v4.0.0 217.6 Command cache dir: /root/.cache/cargo-leptos 217.6 Command installing tailwindcss-v4.0.0 ... 
217.6 Install downloading tailwindcss https://github.com/tailwindlabs/tailwindcss/releases/download/v4.0.0/tailwindcss-linux-arm64 
218.9 Install decompressing tailwindcss /root/.cache/cargo-leptos/tailwindcss-v4.0.0/tailwindcss-v4.0.0 218.9 Command tailwindcss-v4.0.0 installed. 
218.9 Command using tailwindcss v4.0.0 /root/.cache/cargo-leptos/tailwindcss-v4.0.0/tailwindcss-v4.0.0/tailwindcss-linux-arm64 
218.9 Error: No such file or directory (os error 2)

In alpine environment builder should load tailwindcss-linux-arm64-musl binary instead of tailwindcss-linux-arm64 (this is linked with a glibc).

Workaround

Install tailwindcss-linux-arm64-musl manually before the cargo leptos build command in a dockerfile.

Dockerfile - image: rust:alpine3.20 image

FROM rust:alpine3.20 AS builder 
...
...
# Leptos build loads wrong binary file: tailwindcss-linux-arm64 (linked with glibc) 
# Install the correct tailwindcss v4.0.0 binary manually 
RUN rm -rf /root/.cache/cargo-leptos/tailwindcss-v4.0.0 && \
    curl -LO https://github.com/tailwindlabs/tailwindcss/releases/download/v4.0.0/tailwindcss-linux-arm64-musl && \
    chmod +x tailwindcss-linux-arm64-musl && \
    mv tailwindcss-linux-arm64-musl /usr/local/bin/tailwindcss

RUN cargo leptos build --release -vv
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant