2

I am getting an odd error when trying to install TailwindCss into my Rails 7 Ruby 3.1.2 app. I do not understand how to correct this so it compiles / installs properly, any assistance here would be greatly appreciated. Error message below:

Add Tailwindcss include tags and container element in application layout
File unchanged! The supplied flag value not found!  app/views/layouts/application.html.erb
Build into app/assets/builds
       exist  app/assets/builds
   identical  app/assets/builds/.keep
File unchanged! The supplied flag value not found!  app/assets/config/manifest.js
File unchanged! The supplied flag value not found!  .gitignore
File unchanged! The supplied flag value not found!  Procfile.dev
Add bin/dev to start foreman
   identical  bin/dev
Compile initial Tailwind build
         run  rails tailwindcss:build from "."
["/home/starfixx/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/tailwindcss-rails-2.0.16-x86_64-linux/exe/x86_64-linux/tailwindcss", "-i", "/mnt/c/code/telipaxx/app/assets/stylesheets/application.tailwind.css", "-o", "/mnt/c/code/telipaxx/app/assets/builds/tailwind.css", "-c", "/mnt/c/code/telipaxx/config/tailwind.config.js", "--minify"]
/home/starfixx/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/tailwindcss-rails-2.0.16-x86_64-linux/exe/x86_64-linux/tailwindcss: 1: ELF: not found
/home/starfixx/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/tailwindcss-rails-2.0.16-x86_64-linux/exe/x86_64-linux/tailwindcss: 4: Syntax error: word unexpected (expecting ")")
rails aborted!
Command failed with exit 2: /home/starfixx/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/tailwindcss-rails-2.0.16-x86_64-linux/exe/x86_64-linux/tailwindcss

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

Thanks in advance for all your suggestions / assistance. 
Shawn Wilson
  • 1,311
  • 14
  • 40

2 Answers2

1

I am also using Windows 10 and the fix for me was to change my WSL version from 1 to 2 using Windows PowerShell:

wsl --set-version <distro name> 2

You can find your distro name and version by running in Windows PowerShell:

wsl -l -v

For details please visit Microsoft guide: https://learn.microsoft.com/en-us/windows/wsl/install.

PostgreSQL problem: If you are running PostgreSQL on windows you will face an error during connection, you must setup host in database.yml using this guide: WSL2 use "localhost" to access Windows service , and setup route using this: WSL2 and PostgreSQL connection.

-1

You can check out the Tailwind CSS and Rails docs by visiting this page. https://tailwindcss.com/docs/guides/ruby-on-rails

Follow this steps:

  1. Install the gem.

    gem "tailwindcss-rails", "~> 2.0"

  2. Run bundle install.

  3. Run rails tailwindcss:install

This will generate some files where you can add some tailwindcss colors, CSS file, etc, (config/tailwind.config.js)

  1. After that, you have to run rails tailwindcss:build
    This compile your tailwindcss configuration.

  2. Add some test code.

enter image description here

  1. Finally, run rails assets:precompile. This command will compile all your JS and CSS of your JS.

Enjoy!

  • This is how to install it, I have it installed and i am getting file conflicts or errors as my code shows, I know how to install it, I do not understand what to do about the file errors. According to both tailwind and rails the appropriate way to install tailwind on a new rails application is to run it like so ```rails new appname --css tailwind -d database``` – Shawn Wilson Oct 31 '22 at 00:44
  • It's not neccesary to do it at the beggining of creating your rails app. I've done that by installing it after creating my rails apps and works well. – Jorge Ortiz Nov 02 '22 at 04:46