要导入的文件未找到或不可读:bootstrap

我对编程比较陌生,因此我希望这个问题不是绝对愚蠢的。

我的rails应用程序出了问题。

我尝试使用bootstrap。 我构建了一个名为“custom.css.scss”的文件,并使用了“@import”bootstrap“”行。

问题是:每次我保存“custom.css.scss”文件时,都会自动生成一个新文件“custom.css”,并收到以下消息:“custom.css.scss要导入的文件未找到或不可读:bootstrap ”。

有趣的是:当我删除文件“custom.css.scss”并刷新我的浏览器时,一切都很好(这意味着:使用了bootstrap)。

你有什么想法,可能是什么原因?

最基本的问候克里斯

PS:这是我安装的gem文件

source 'https://rubygems.org' gem 'rails', '3.2.11' gem 'bootstrap-sass', '2.1' gem 'bcrypt-ruby', '3.0.1' gem 'faker', '1.0.1' gem 'will_paginate', '3.0.3' gem 'bootstrap-will_paginate', '0.0.6' gem 'jquery-rails', '2.0.2' group :development, :test do gem 'sqlite3', '1.3.5' gem 'rspec-rails', '2.11.0' # gem 'guard-rspec', '1.2.1' # gem 'guard-spork', '1.2.0' # gem 'spork', '0.9.2' 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 group :test do gem 'capybara', '1.1.2' gem 'factory_girl_rails', '4.1.0' gem 'cucumber-rails', '1.2.1', :require => false gem 'database_cleaner', '0.7.0' gem 'launchy', '2.1.0' # gem 'rb-fsevent', '0.9.1', :require => false # gem 'growl', '1.0.3' end group :production do gem 'pg', '0.12.2' end 

custom.css.scss文件如下所示

 @import "bootstrap"; /* universal */ html { overflow-y:scroll } body { padding-top: 60px } section { overflow: auto; } textarea { resize: vertial; } .center { text-align: center; } .center h1 { margin-bottom: 10px; } /* typography */ h1, h2, h3, h4, h5, h6 { line-height: 1 } h1 { font-size: 3em; letter-spacing: -2px; margin-bottom: 30px; text-align: center; } h2 { font-size: 1.7em; letter-spacing: -1px; margin-bottom: 30px; text-align: center; font-weight: normal; color: #999; } p { font-size: 1.1em; line-height: 1.7em; } 

我遇到了类似的问题,看到了Habax的解决方案并首先尝试了最后一步。

我刚刚重启了服务器。

结果certificate是足够的。 希望有所帮助。

我遇到了类似的问题,我将文件类型从css更改为scss。 我敢打赌,如果你从你的文件名中删除’.css’它会起作用。

在新应用程序中遇到同样的问题,但重新启动开发服务器解决了这个问题。

面临同样的问题。 我将custom.css.scss重命名为custom.css,并在Gemfile中指定了ruby版本。 和捆绑安装。 就我而言:ruby’2.0.0′

我有同样的问题,通过修复bootstrap-sass和sass-rails版本来解决:

 gem 'sass-rails', '~> 3.2' gem 'bootstrap-sass', '~> 2.3.1.0' 

然后bundle install和服务器重启。

我只是想通过我的决议作为参考。 我今天也遇到过这个问题。 如果你也使用sccs模式的emacs,它可能会有所帮助。 保存scss文件时默认为emacs将自动编译这些scss文件并创建响应的.css文件。 那么你只需要删除这些.css文件。 或将以下代码放在.emacs作为永久修复

 (setq scss-compile-at-save nil) ;; disable the auto-compilation 

我在我的scss文件中遇到了“导入未找到或不可读的文件:bootstrap”的问题 。 我刚刚通过将“bootstrap-sass”的 require语句添加到config.ru文件来解决。 我的config.ru如下所示。

 # This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) require 'bootstrap-sass' #require statement of bootstrap-sass run Rails.application