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

Missing tailwind.css in production #114

Closed
wiiikiii opened this issue Dec 23, 2021 · 5 comments
Closed

Missing tailwind.css in production #114

wiiikiii opened this issue Dec 23, 2021 · 5 comments

Comments

@wiiikiii
Copy link

I am running freebsd in production.

Locally I am preparing for production

bundle exec rake assets:precompile RAILS_ENV=production

the following file has been created

I, [2021-12-23T15:20:13.950831 #72321] INFO -- : Writing dev.site/public/assets/tailwind-9a9d4d350c33eade01e355193e6b277f587e92f4a1bd036122cd72af203f15a1.css
I, [2021-12-23T15:20:13.951302 #72321] INFO -- : Writing dev.site/public/assets/tailwind-9a9d4d350c33eade01e355193e6b277f587e92f4a1bd036122cd72af203f15a1.css.gz

and sync the all file to the server.

rsync -aPv public/assets public/packs server.name:/home/www/site/public/

after touch tmp/restart.txt in production I get the error in production log.

ActionView::Template::Error (The asset "tailwind.css" is not present in the asset pipeline.
):
 5:     <meta name="viewport" content="width=device-width,initial-scale=1"> 
 6:     <%= csrf_meta_tags %>
 7:     <%= csp_meta_tag %>
 8:     <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
 9:
10:     <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
11:     <%= javascript_importmap_tags %>

app/views/layouts/application.html.erb:8

The tailwind.css exists in app/assets/builds/

@RathanKumar
Copy link

I came across this issue found a workaround from the log while deploying. Checkout the log below.

remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        ERROR: Cannot find the tailwindcss executable for x86_64-linux in /tmp/build_5e1bf869/vendor/bundle/ruby/3.0.0/gems/tailwindcss-rails-2.0.2/exe
remote:        If you're using bundler, please make sure you're on the latest bundler version:
remote:
remote:          gem install bundler
remote:          bundle update --bundler
remote:
remote:        Then make sure your lock file includes this platform by running:
remote:
remote:          bundle lock --add-platform x86_64-linux
remote:          bundle install
remote:
remote:        See `bundle lock --help` output for details.
remote:        Asset precompilation completed (1.07s)
remote:        Cleaning assets
remote:        Running: rake assets:clean
remote: -----> Detecting rails configuration

Looks like this is an issue that tailwind is not available for arm. For now I got it fixed by adding linux platform to Gemfile.lock using:

bundle lock --add-platform x86_64-linux

Probably #112 might fix this issue.

@dixpac
Copy link
Contributor

dixpac commented Jan 7, 2022

@wiiikiii is your issue solved when using the latest release (v 2.0.3)?

@gorka
Copy link

gorka commented Jan 11, 2022

Same thing is happening to me. I'm running OpenBSD in production. I set up the whole thing locally and then rsync the same way @wiiikiii is doing and I'm getting the same error.

I'm with Rails 7.0.0 and tailwindcss-rails 2.0.4.

@ghost
Copy link

ghost commented Jan 12, 2022

Same goes for me, with platform 'x86_64-linux' in production and locally on 'arm64-darwin-21'. I get also the above error.
Running the server in development mode works fine.

I am on Rails 7.0.1 and tailwindcss-rails 2.0.4

Edit:

If I change the following parameter in the production config from:

config.assets.compile = false

to

config.assets.compile = true

It doesn't throw the error any more. I know that's not ideal. Any ideas how to properly fix this?

@dhh
Copy link
Member

dhh commented Jan 16, 2022

If you're running on separate platforms, you need to add the platforms needed. See https://github.com/rails/tailwindcss-rails#check-bundler-platforms

@dhh dhh closed this as completed Jan 16, 2022
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

No branches or pull requests

5 participants