File to import not found or unreadable: bootstrap-

2019-07-03 10:57发布

问题:

I have a Rails 4rc1 application with multiple engines. I'm using bootstrap-wysihtml5-rails gem in my admin engine. According to documentation I added gem 'bootstrap-wysihtml5-rails' to admin engine's Gemfile. Then when I added @import 'bootstrap-wysihtml5' to admin engine's application.scss. I get below errors:

File to import not found or unreadable: bootstrap-wysihtml5.
Load paths:
  /home/zoloo/.rvm/gems/ruby-1.9.3-p429@rails-4rc1/gems/coffee-rails-4.0.0/lib/assets/javascripts
  /home/zoloo/.rvm/gems/ruby-1.9.3-p429@rails-4rc1/gems/font-awesome-sass-rails-3.0.2.2/app/assets/fonts
  /home/zoloo/.rvm/gems/ruby-1.9.3-p429@rails-4rc1/gems/font-awesome-sass-rails-3.0.2.2/app/assets/stylesheets
  /home/zoloo/.rvm/gems/ruby-1.9.3-p429@rails-4rc1/gems/bootstrap-sass-2.3.1.0/vendor/assets/images
  /home/zoloo/.rvm/gems/ruby-1.9.3-p429@rails-4rc1/gems/bootstrap-sass-2.3.1.0/vendor/assets/javascripts
  /home/zoloo/.rvm/gems/ruby-1.9.3-p429@rails-4rc1/gems/bootstrap-sass-2.3.1.0/vendor/assets/stylesheets

It seems like my application.scss can't find bootstrap-wysihtml5. But why? I don't have any idea :( By the way JavaScript is working fine. And here is the my environments:

Gems included by the bundle:
  * actionmailer (4.0.0.rc1)
  * actionpack (4.0.0.rc1)
  * activemodel (4.0.0.rc1)
  * activerecord (4.0.0.rc1)
  * activerecord-deprecated_finders (1.0.2)
  * activesupport (4.0.0.rc1)
  * addressable (2.3.4)
  * admin (0.0.1)
  * arel (4.0.0)
  * atomic (1.1.8)
  * bcrypt-ruby (3.0.1)
  * bootstrap-sass (2.3.1.0)
  * bootstrap-wysihtml5-rails (0.3.1.20)
  * builder (3.1.4)
  * bundler (1.3.5)
  * capybara (2.1.0)
  * carrierwave (0.8.0)
  * coffee-rails (4.0.0)
  * coffee-script (2.2.0)
  * coffee-script-source (1.6.2)
  * core (0.0.1)
  * diff-lcs (1.2.4)
  * erubis (2.7.0)
  * execjs (1.4.0)
  * factory_girl (4.2.0)
  * factory_girl_rails (4.2.1)
  * ffaker (1.16.1)
  * font-awesome-sass-rails (3.0.2.2)
  * hike (1.2.2)
  * i18n (0.6.4)
  * jquery-rails (2.2.1)
  * kaminari (0.14.1)
  * launchy (2.3.0)
  * letter_opener (1.1.1)
  * mail (2.5.3)
  * mime-types (1.23)
  * mini_magick (3.6.0)
  * minitest (4.7.3)
  * multi_json (1.7.2)
  * nokogiri (1.5.9)
  * pg (0.15.1)
  * polyglot (0.3.3)
  * rack (1.5.2)
  * rack-test (0.6.2)
  * rails (4.0.0.rc1)
  * railties (4.0.0.rc1)
  * rake (10.0.4)
  * rspec-core (2.13.1)
  * rspec-expectations (2.13.0)
  * rspec-mocks (2.13.1)
  * rspec-rails (2.13.2)
  * sass (3.2.8)
  * sass-rails (4.0.0.rc1)
  * shoulda-matchers (2.1.0)
  * simplecov (0.8.0.pre)
  * simplecov-html (0.7.1)
  * sprockets (2.9.3)
  * sprockets-rails (2.0.0.rc4)
  * state_machine (1.2.0)
  * subexec (0.2.3)
  * thor (0.18.1)
  * thread_safe (0.1.0)
  * tilt (1.3.7)
  * treetop (1.4.12)
  * tzinfo (0.3.37)
  * upsert (1.2.0)
  * warden (1.2.1)
  * xpath (2.0.0)

回答1:

as found on https://github.com/Nerian/bootstrap-wysihtml5-rails/issues/62

replace:

@import 'bootstrap-wysihtml5'

with:

@import "bootstrap-wysihtml5/core"
@import "bootstrap-wysihtml5/wysiwyg-color"