1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails6 ActionText couldn't find file 'trix/dist/trix' with type 'text/css'

Posted at

Action Textをインストール後、サーバーを立ち上げた際に、このようなエラーが出ることがあります。

couldn't find file 'trix/dist/trix' with type 'text/css'

原因

yarnが入っていない状態で

$ rails action_text:install

をすると、migrationファイルは追加されてるので、大丈夫かと思うと、jsonファイルを確認すると

actiontextとtrixがない状態です。

package.json

{
  "name": "myapp",
  "private": true,
  "dependencies": {
    "@fortawesome/fontawesome-free": "^5.10.2",
    "@rails/actioncable": "^6.0.0-alpha",
    "@rails/activestorage": "^6.0.0-alpha",
    "@rails/ujs": "^6.0.0-alpha",
    "@rails/webpacker": "^4.0.7",
    "jquery": "^3.4.1",
    "noty": "^3.2.0-beta",
    "turbolinks": "^5.2.0"
  },
  "version": "0.1.0",
  "devDependencies": {
    "webpack-dev-server": "^3.8.0"
  }
}

解決

yarnをちゃんと入れてから

$ yarn install --check-files

再度 Action Textをインストール

$ rails action_text:install
package.json

{
  "name": "myapp",
  "private": true,
  "dependencies": {
    "@fortawesome/fontawesome-free": "^5.10.2",
    "@rails/actioncable": "^6.0.0-alpha",
    "@rails/actiontext": "^6.0.0", #確認
    "@rails/activestorage": "^6.0.0-alpha",
    "@rails/ujs": "^6.0.0-alpha",
    "@rails/webpacker": "^4.0.7",
    "jquery": "^3.4.1",
    "noty": "^3.2.0-beta", #確認
    "trix": "^1.0.0",
    "turbolinks": "^5.2.0"
  },
  "version": "0.1.0",
  "devDependencies": {
    "webpack-dev-server": "^3.8.0"
  }
}

actiontextとtrixが入って入れば大丈夫

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?