1

I am trying to install Bootstrap on Rails but can't seem to get it installed. I have ran bundle install , bundle update and rails server but just can't seem to get it to work.

Here is the error code:

File to import not found or unreadable: bootstrap.
Load paths:
c:/Users/teddynuts/Desktop/pinteresting/app/assets/images c:/Users/teddynuts/Desktop/pinteresting/app/assets/javascripts c:/Users/teddynuts/Desktop/pinteresting/app/assets/stylesheets c:/Users/teddynuts/Desktop/pinteresting/vendor/assets/javascripts c:/Users/teddynuts/Desktop/pinteresting/vendor/assets/stylesheets c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/turbolinks-2.2.2/lib/assets/javascripts c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/jquery-rails-3.1.0/vendor/assets/javascripts c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/coffee-rails-4.0.1/lib/assets/javascripts
(in c:/Users/teddynuts/Desktop/pinteresting/app/assets/stylesheets/bootstrap_and_customization.css.scss:1)

My CSS file titled bootstrap_and_customization.css.scss code is:

    @import "bootstrap";

My Gem file code is:

    source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0'  
gem 'bootstrap-sass',

group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
Zanon
  • 29,231
  • 20
  • 113
  • 126
Qin En
  • 11
  • 1

3 Answers3

0

You need to assign something to your "group". What goes into group :doc ?

I see that you are taking the One Month Rails Tutorial, so the gemfile for the Lesson (Until bootstrap) should be this:

source 'https://rubygems.org'

gem 'rails', '4.1.0'

gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jquery-turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'bootstrap-sass', '~> 3.1.1'

# Gems for Local Development
group :development, :test do
    gem 'sqlite3'
end

# Gems for Heroku
group :production do
    gem 'pg'
    gem 'rails_12factor'
end

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

Official Sass port of Bootstrap

Sometimes when you are stuck just give the Official Repo a look.

Mini John
  • 7,855
  • 9
  • 59
  • 108
0

The problem is here:

gem 'bootstrap-sass',

group: :doc

It may not be obvious, but it's one statement. In fact, it's interpreted like this:

gem 'bootstrap-sass', { :group => :doc }

...and therefore the specified gem is only available during docs generation. And the solution for this exact issue is to replace the above with:

gem 'bootstrap-sass'

However, since you're on Windows (if it's x64, which is likely), you may run into other issues, like this one.

Community
  • 1
  • 1
D-side
  • 9,150
  • 3
  • 28
  • 44
0

Try bootstrap-sass-rails instead. It works in the asset pipeline. https://github.com/yabawock/bootstrap-sass-rails

Eddie Prislac
  • 145
  • 1
  • 10