5

我已经找到了一些关于我的问题的主题,但我不明白应该如何解决它。

我正在关注http://ruby.railstutorial.org/chapters/filling-in-the-layout#fnref-5_5教程并通过在 app/assets/stylesheets/custom.css.scss 中导入引导程序而陷入困境。

那是我的 Gemfile:

source 'https://rubygems.org'
gem 'bootstrap-sass', '2.0.4'
gem 'rails', '3.2.8'

group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
end

Gems used only for assets and not required
in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :test do
gem 'capybara', '1.1.2'
end

group :production do
gem 'pg', '0.12.2'
end

我在 localhost/sample_app/home 上遇到了什么错误

Sass::SyntaxError in Static_pages#home

Showing c:/Users/katja/Arbeit/rails_projects/sample_app/app/views/layouts/application.html.erb where line #5 raised:

File to import not found or unreadable: bootstrap.
Load path: Sass::Rails::Importer(c:/Users/katja/Arbeit/rails_projects/sample_app/app/assets/stylesheets/custom.css.scss)
(in c:/Users/katja/Arbeit/rails_projects/sample_app/app/assets/stylesheets/custom.css.scss)
Extracted source (around line #5):

2: 
3:

4: <%= full_title(yield(:title)) %>
5: <%= stylesheet_link_tag "application", media: "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: <!--[if lt IE 9]>
Rails.root: c:/Users/katja/Arbeit/rails_projects/sample_app
Application Trace | Framework Trace | Full Trace
app/assets/stylesheets/custom.css.scss:1
app/views/layouts/application.html.erb:5:in `app_views_layouts_application_html_erb_16020705_20168520'

我正在使用 Windows 和 GitBash。我已经尝试删除 tmp/cache,它没有帮助。一切运行完美,但是当我添加 @import "bootstrap"; 到 cusom.css.scss,我得到一个错误。

4

3 回答 3

8

重新启动 Web 服务器“rails s”。

于 2012-12-07T17:27:43.823 回答
0

我不得不重新启动服务器 ps aux | grep 轨道杀死 -9 12345

其中 12345 是进程号

(不确定是否有另一种方法可以重新启动 Rails?

于 2012-12-27T12:38:16.900 回答
0
  source 'https://rubygems.org'
  gem 'rails', '3.2.8'

  group :development, :test do
  gem 'sqlite3', '1.3.5'
  gem 'rspec-rails', '2.11.0'
  end

  Gems used only for assets and not required
  in production environments by default.
  group :assets do
  gem 'sass-rails', '3.2.5'
  gem 'bootstrap-sass', '2.0.4'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
  end

  gem 'jquery-rails', '2.0.2'

  group :test do
  gem 'capybara', '1.1.2'
  end

  group :production do
  gem 'pg', '0.12.2'
  end

将你的 bootstrap-sass gem 添加到 assets 块中

于 2013-02-10T16:16:14.317 回答