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

前端 未结 15 1315
眼角桃花
眼角桃花 2020-11-30 03:40

I am suddenly getting this error in development and in production on deployment.

custom.css.scss

@import \"bootstrap-sprockets\";
@import \"bootstrap         


        
相关标签:
15条回答
  • 2020-11-30 04:13

    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.

    0 讨论(0)
  • 2020-11-30 04:14

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

    Restarting the rails server worked like a charm! :D

    0 讨论(0)
  • 2020-11-30 04:16

    I solved this issue by upgrading bootstrap-sass

    gem 'bootstrap-sass', '3.2.0.2'
    
    0 讨论(0)
  • 2020-11-30 04:16

    put this in gem file

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

    then run $ bundle install

    Restart the server.

    0 讨论(0)
  • 2020-11-30 04:18

    I have observed the same behaviour. In my case i have removed the version of the gem 'bootstap-sass' and it worked. There might be compatibility issue with the gem version which was causing the problem.

    Gem file

    gem 'bootstrap-sass'
    

    After making changes in the gem file perform following commands:

    bundle install
    

    If the server is already running then stop it by "CTRL+C" and start the server again

    rails s
    
    0 讨论(0)
  • 2020-11-30 04:19

    This error mostly comes in rails 3.2.x versions. If you are using rails version 3.2 you have to specify a special version in your gem file like below:

    gem 'rails', '3.2.0'
    gem 'bootstrap-sass', '3.2.0.2'
    

    It will resolve the problem for rails -v '3.2.0'

    0 讨论(0)
提交回复
热议问题