Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

So I am using rails 6.0.1 and trying to use Action text. So I run the command rails action_text:install and add the gem image_processing and finally run rails db:migrate

When I launch my app I got this error message:

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

under assets/config/stylesheets/actiontext.scss I have: //= require trix/dist/trix and config/initiliazers/assets.rb: Rails.application.config.assets.paths << Rails.root.join('node_modules')

Any idea how I could solve this?

like image 479
chris Avatar asked Dec 14 '19 09:12

chris


2 Answers

I actually find the solution. I had to run yarn install --check-files then reinstall action_text: rails action_text:install and then it fixed the issue.

like image 70
chris Avatar answered Oct 17 '22 14:10

chris


The issue arises while setting up your Rails 6 app for the first time on your PC. You need to install the JS dependencies. Run these lines of code

bundle install
yarn install --check-files
rails action_text:install
like image 26
Ayeni Lawrence Avatar answered Oct 17 '22 16:10

Ayeni Lawrence