1
votes

I've got a fresh rails application, and I'm trying to use the bootstrap-sass gem. When I add @import "bootstrap"; in a .scss file in my app/assets/stylesheets folder, I get this SASS compilation error:

(Line 1: File to import not found or unreadable: bootstrap.

I've seen that many others have had this error, but everything suggested hasn't worked. I've made sure to reboot the server after running bundle install, I even deleted my entire gemset and started fresh. Still, while following the instructions on the bootstrap-sass github page, I get this error, and I can't figure it out!

Gemfile:

source 'https://rubygems.org'

ruby '2.0.0'

gem 'rails', '4.0.0.rc2'

gem 'pg', '~> 0.17.1'

gem 'coffee-rails', '~> 4.0.0'

gem 'sass-rails', '>= 3.2'

gem 'bootstrap-sass', '~> 3.0.3.0'

gem 'uglifier', '>= 1.3.0'

gem 'jquery-rails'

gem 'turbolinks'

gem 'jbuilder', '~> 1.2'

group :doc do

gem 'sdoc', require: false

end

gem 'bcrypt-ruby', '~> 3.0.0'

And the error output:

sass --update '/app_root/app/assets/stylesheets/' > error /path/to/app_root/app/assets/stylesheets/global.scss (Line 1: >File to >import not found or unreadable: bootstrap. Load paths: /path/to/app_root/app/assets/stylesheets /path/to/app_root/app/assets/stylesheets) > Compilation exited abnormally with code 1

I'm thinking there may be an issue with the "Load Paths", but when I open a rails console and check Sass.load_paths, it includes the directory of the bootstrap-sass gem.

Any suggestions would be welcome. I've been trying to deal with this for hours now, to no avail.

1
You put the import statement in "application.css.scss" or "application.scss"? Also, where did you see this error? Are you doing something on the command line or just trying to run the app?Lee Smith
@LeeSmith if HolidayTrousers and I are experiencing the same error it occurs on any page load. Additionally the import is in application.css.scss (per install instructions. Attempts at importing bootstrap in a required file lead to the same issue.rjmcdonald83
The import statement is in the (otherwise empty) file global.scss. The same error results when I try to import bootstrap from the application.css.scss file generated by rails. And yes, the error occurs an any page load, because each page tries to use global.scss.HolidayTrousers

1 Answers

0
votes

Ok, I have no idea why this works, but I've been bashing my head against the problem for so long I no longer care.

I found this tutorial and followed it explicitly (easy, because my app is basically empty) from the start. It uses the rails_layout gem, and, somehow, bootstrap is now working as intended.