Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails 4: cannot load such file -- sass

I want to use bootstrap in my project. My operating system is Windows, Ruby version is 1.9.3, Rails version 4.0.4.

I try to bundle one gem every time because there is dependence in some gem when I execute bundle install.

bootstrap-sass (2.3.2.0)
sass (3.3.5, 3.2.19)
sass-rails (4.0.2)
sprockets (2.12.0, 2.11.0)

Now, I add //= require bootstrap into application.js and add @import "bootstrap" into application.css.scss. But when I start server, I got Load Error in *Controller#home:

cannot load such file -- sass (in D:/first_app/app/assets/style sheets / application.css.scss

Extracted source (around line #5):

<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %> <%= csrf_meta_tags %>

Rails.root: D:/rails_projects/first_app

Any advice?

like image 636
zhangyanan Avatar asked Apr 16 '14 09:04

zhangyanan


1 Answers

Did you make sure that you also removed the sprockets //= require directive in your application.css.scss file?

Also, make sure all your gem versions are aligned. According to this rubygems page, version 2.3.2 of boostrap-rails requires version 3.1 for the saas gem. Running bundle install should also notify you of any gem version mismatches in your Gemfile.

Finally, if you're using Rails 4, why are you using an older version of bootstrap-rails? The latest stable version of bootstrap-rails is 3.1.1.0 (as of Feb 13, 2014).

like image 114
richsinn Avatar answered Oct 03 '22 14:10

richsinn