Twitter-bootstrap-rails:它是否将Bootstrap安装到项目中?

我根据自述文件执行所有操作但在启动rails应用程序时遇到问题: Sprockets :: FileNotFound它指向//= require twitter/bootstrap这个gem是否真的安装了bootstrap样式表和相应的js库,或者应该手动安装它们(用凉亭或其他方式)? 这是我的Gemfile:

 # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.5.1' # Use postgresql as the database for Active Record gem 'pg', '~> 0.15' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # 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', 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 group :assets do gem 'twitter-bootstrap-rails' end gem 'responders', '~> 2.1.1' gem 'haml' group :development, :test do gem 'pry-byebug' gem 'pry-rails' gem 'rspec-expectations', '~> 3.0.0' gem 'spring-commands-rspec' #gem 'guard-rspec', require: false gem 'rspec-rails', '~> 3.0.0' # Support for its syntax gem 'rspec-its', '~> 1.0.1' gem 'shoulda-matchers', '~> 3.1.1' gem 'factory_girl_rails' gem 'ffaker' gem "bower-rails", "~> 0.10.0" end group :development do # Access an IRB console on exception pages or by using  in views gem 'web-console', '~> 2.0' gem 'haml-rails' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' end 

我之所以这么说,是因为Rails 4中的group assets被丢弃了 。 来自文档:

Rails 4.0从Gemfile中删除了资产组。 升级时,您需要从Gemfile中删除该行。 您还应该更新您的应用程序文件(在config / application.rb中):

所以不要使用它

 .... # Use Capistrano for deployment # gem 'capistrano-rails', group: :development group :assets do gem 'twitter-bootstrap-rails' end .... 

只需删除group块:

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

然后运行bundle install并重启服务器。

更多信息 – 为什么Rails4放弃了对Gemfile中“assets”组的支持