0

我根據Readme一切,但有一個問題開始做一個Rails應用程序時:鏈輪:: FileNotFound並將其指向//= require twitter/bootstrap這是否真的寶石安裝引導樣式表和相應的JS庫或者一個應該手動安裝(與涼亭或以另一種方式)? 這裏是我的Gemfile:Twitter-bootstrap-rails:它是否將Bootstrap安裝到項目中?

# 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 <%= console %> 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 
+0

這種寶石應該讓所有的js和提供給你舉圖書館的CSS。你重新啓動了你的服務器嗎?另外,你可以添加你的Gemfile的問題。 – dp7

+0

@dkp是的,我重新啓動了服務器。 – DreamWalker

回答

1

我會說,因爲group assets were dropped in Rails 4。從文檔:

Rails 4.0從Gemfile中刪除資產組。升級時需要從Gemfile中刪除該行。你也應該更新您的應用程序文件(在配置/ 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並重新啓動服務器。

更多信息 - Why did Rails4 drop support for 「assets」 group in the Gemfile

+0

Yeap,這很合理,謝謝! – DreamWalker

+0

不客氣。另外,如果答案解決了您的問題,請接受它。 – Vucko

相關問題