Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to install Tailwind 2.0 to an existing project (rails 6.1) but get an error :

How to install Tailwind 2.0 on existing Rails project (6.1 and sprocket)

In my gemfile I added :

gem "webpacker", github: "rails/webpacker", ref: 'b6c2180'

app/javascript/application.js

import Rails from "@rails/ujs"
import Turbolinks from "turbolinks"
import * as ActiveStorage from '@rails/activestorage';
import '../utils/direct_uploads.js';
require("app/javascript/stylesheets/application.css")
Rails.start();
Turbolinks.start();
ActiveStorage.start();

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

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>

In the folder app/javascript/stylesheets/

app/javascript/stylesheets/application.css

@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";

the file tailwind.config.js

And have run rails webpacker:install and rails s but get an error :

Webpacker::Manifest::MissingEntryError - Webpacker can't find application.css in /Users/ben/code/Tioneb12/postgis/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
   unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
  "entrypoints": {
  }
}

I'm trying :

rails asset:clobber
yarn
rails asset:precompile

and get another error :

/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory looking for modules in /Users/ben/node_modules
No description file found looking for modules in /Users/ben/code/Tioneb12/postgis/node_modules
using description file: /Users/ben/code/Tioneb12/postgis/package.json (relative path: ./node_modules)
using description file: /Users/ben/code/Tioneb12/postgis/package.json (relative path: ./node_modules/babel-loader)
no extension /Users/ben/code/Tioneb12/postgis/node_modules/babel-loader doesn't exist
.js
/Users/ben/code/Tioneb12/postgis/node_modules/babel-loader.js doesn't exist
No description file found .json
/Users/ben/code/Tioneb12/postgis/node_modules/babel-loader.json doesn't exist no extension
/Users/ben/node_modules/babel-loader doesn't exist as directory
/Users/ben/code/Tioneb12/postgis/node_modules/babel-loader doesn't exist .js
/Users/ben/node_modules/babel-loader.js doesn't exist .json
/Users/ben/node_modules/babel-loader.json doesn't exist as directory
/Users/ben/node_modules/babel-loader doesn't exist
question from:https://stackoverflow.com/questions/65922297/how-to-install-tailwind-2-0-to-an-existing-project-rails-6-1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

Just remove the folder tmp/cache/assets worked for me ;)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...