Can't setup tailwind css with rails 7.0.4.2

Although I followed all the steps and even tried the --css-tailwind pre-configured project setup I always get the same Error

/var/lib/gems/3.0.0/gems/tailwindcss-rails-2.0.27-x86_64-linux/exe/x86_64-linux/tailwindcss: 1: ELF: not found
/var/lib/gems/3.0.0/gems/tailwindcss-rails-2.0.27-x86_64-linux/exe/x86_64-linux/tailwindcss: 4: Syntax error: word unexpected (expecting ")")
rails aborted!
Command failed with exit 2: /var/lib/gems/3.0.0/gems/tailwindcss-rails-2.0.27-x86_64-linux/exe/x86_64-linux/tailwindcss

Tasks: TOP => assets:precompile => tailwindcss:build
(See full trace by running task with --trace)

Additionally, I get the following when I try to use the tailwind

The asset "tailwind.css" is not present in the asset pipeline.

NOTE: I am using ubuntu 22.04.2 via WSL version 1

1 Like

…I followed all the steps…

did you mean the steps mentioned by the gem?

Official tailwind documentation Install Tailwind CSS with Ruby on Rails - Tailwind CSS

Have you tried doing a bundle install/update just to check the gem installed successfully?

Default rails new app plus bundle add tailwindcss-rails and rails tailwindcss:install

ruby “3.2.0” # I think the tutorial is set for 3.2.1 gem “rails”, “~> 7.0.4”, “>= 7.0.4.3” gem “sprockets-rails” gem “puma”, “~> 5.0” gem “importmap-rails” gem “turbo-rails” gem “stimulus-rails” gem “tailwindcss-rails”, “~> 2.0”

Works fine on macOS. I just did this session a day or two ago.

Beyond what was asked but Tailwindcss removes some formatting but a class ‘prose’ at top level adds basic formatting.

yes I did, I made sure its installed

It looks like there is something wrong with your tailwind executable

can you run tailwindcss from the command line?

if not try “gem uninstall tailwindcss-rails” and then run bundler again.

Hello, I also encountered the same problem. How did you succeed

After installing Tailwind CSS, I encountered the same error, even though I followed the installation steps outlined in the official Tailwind documentation. To overcome the issue, I turned to the “Tailwind CSS for Rails” documentation in github, which provided the solution I needed. A critical step that made a difference was executing the following command: tailwindcss:watch[poll].

If you’re facing a similar problem, I recommend referring to the Tailwind CSS for Rails for detailed instructions on resolving this issue.

I spent a lot of time on this kind of problem (Tailwind), it turns out the solution is very easy, just follow the link below: