【问题标题】:Rails 6.0 action text couldn't find file 'trix/dist/trix' with type 'text/css'Rails 6.0 操作文本找不到类型为“text/css”的文件“trix/dist/trix”
【发布时间】:2020-04-07 13:43:12
【问题描述】:

所以我正在使用 rails 6.0.1 并尝试使用操作文本。 所以我运行命令rails action_text:install 并添加 gem image_processing 最后运行 rails db:migrate

当我启动我的应用程序时,我收到了以下错误消息:

Sprockets::FileNotFound in Hotels#index
Showing /myapp/app/views/layouts/application.html.erb where line #8 raised:

couldn't find file 'trix/dist/trix' with type 'text/css'
Checked in these paths: 
  /myapp/app/assets/config
  /myapp/app/assets/images
  /myapp/app/assets/javascripts
  /myapp/app/assets/stylesheets
  /usr/local/bundle/gems/cloudinary-1.13.1/vendor/assets/html
  /usr/local/bundle/gems/cloudinary-1.13.1/vendor/assets/javascripts
  /usr/local/bundle/gems/activeadmin-2.5.0/app/assets/javascripts
  /usr/local/bundle/gems/activeadmin-2.5.0/app/assets/stylesheets
  /usr/local/bundle/gems/activeadmin-2.5.0/vendor/assets/javascripts
  /usr/local/bundle/gems/jquery-rails-4.3.5/vendor/assets/javascripts
  /usr/local/bundle/gems/formtastic-3.1.5/app/assets/stylesheets
  /usr/local/bundle/gems/actioncable-6.0.1/app/assets/javascripts
  /usr/local/bundle/gems/activestorage-6.0.1/app/assets/javascripts
  /usr/local/bundle/gems/actionview-6.0.1/lib/assets/compiled
  /usr/local/bundle/gems/turbolinks-source-5.2.0/lib/assets/javascripts
  /myapp/node_modules

在 assets/config/stylesheets/actiontext.scss 我有: //= require trix/dist/trix 和配置/初始化程序/assets.rb: Rails.application.config.assets.paths << Rails.root.join('node_modules')

知道如何解决这个问题吗?

【问题讨论】:

    标签: r ruby-on-rails ruby actiontext


    【解决方案1】:

    我实际上找到了解决方案。 我不得不跑 yarn install --check-files 然后重新安装action_text: rails action_text:install 然后它解决了这个问题。

    【讨论】:

    • 感谢分享这个解决方案。我跟着它,没有遇到任何看起来像错误的东西,但我仍然收到相同的错误消息。您对此还有其他想法吗?
    • 请问你是怎么解决的?
    • @AndreasGebhard 有同样的问题,我已经解决了它在 config/initializers/assets.rb 中添加Rails.application.config.assets.paths &lt;&lt; Rails.root.join('node_modules'),然后执行@chris 建议的操作
    猜你喜欢
    • 2020-04-13
    • 2017-01-06
    • 2019-05-19
    • 1970-01-01
    • 1970-01-01
    • 2016-07-21
    • 2021-01-08
    • 1970-01-01
    • 2023-02-22
    相关资源
    最近更新 更多