0

Tailwind 2.0 を既存のプロジェクト (rails 6.1) にインストールしようとしていますが、エラーが発生します:

Tailwind 2.0 を既存の Rails プロジェクト (6.1 および sprocket) にインストールする方法

私のgemfileに追加しました:

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

アプリ/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' %>

app/javascript/stylesheets/ フォルダー内

app/javascript/stylesheets/application.css

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

ファイル tailwind.config.js

そして実行rails webpacker:installrails sましたが、エラーが発生しました:

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": {
  }
}

私はしようとしています :

rails asset:clobber
yarn
rails asset:precompile

別のエラーが発生します:

/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
4

1 に答える 1

0

tmp/cache/assets私のために働いたフォルダを削除するだけです;)

于 2021-02-05T17:56:25.107 に答える