Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sass::SyntaxError: File to import not found or unreadable: bootstrap-sprockets

After making changes to Gemfile, do not forget to restart the server with rails s

Restarting the rails server worked like a charm! :D


I solved this issue by upgrading bootstrap-sass

gem 'bootstrap-sass', '3.2.0.2'

Please restart you rails server after every changes in Gemfile

rails server

For the Sass version of Bootstrap 5 in versions of rails before 6 use

gem `bootstrap`

For Sass versions of Bootstrap 3 and 2 Make sure you don't have

gem 'bootstrap'  # Remove this line
gem 'bootstrap-sass'

It should just be

gem 'bootstrap-sass'

I solved it in following steps:

  1. List item
  2. copying the "bootstrap.css" in my "app/assets/stylesheets/ (it was missing)
  3. gem install autoprefixer-rails (also modify Gemfile)
  4. gem install sprockets (also modify Gemfile)
  5. bundle install
  6. RESTART server (not just refreshing page)

This is how I solved the issue.

Go to Bootstrap for Sass Github page and follow the instructions:

  1. Add the following to the Gemfile

    gem 'bootstrap-sass', '~> 3.3.6' gem 'sass-rails', '>= 3.2'

  2. Run the command bundle install

  3. Start/restart the server

    rails s

Also, make sure the file has .scss extension (or .sass for Sass syntax). If you have just generated a new Rails app, it may come with a .css file instead. If this file exists, it will be served instead of Sass, so rename it. Then, remove all the *= require_self and *= require_tree . statements from the sass file. Instead, use @import to import Sass files.