简体   繁体   English

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

[英]File to import not found or unreadable: bootstrap

I am relatively new to programming, therefore I hope that the question is not absolutely stupid. 我对编程比较陌生,因此我希望这个问题不是绝对愚蠢的。

I got a problem concerning my rails app. 我的rails应用程序出了问题。

I try to use bootstrap. 我尝试使用bootstrap。 I built a file called "custom.css.scss" and used the "@import "bootstrap"" line in it. 我构建了一个名为“custom.css.scss”的文件,并在其中使用了“@import”bootstrap“”行。

The problem is: Each time I save my "custom.css.scss" file a new file "custom.css" is automatically generated and I get the following message: "custom.css.scss File to import not found or unreadable:bootstrap". 问题是:每次我保存“custom.css.scss”文件时,都会自动生成一个新文件“custom.css”,并收到以下消息:“custom.css.scss要导入的文件未找到或不可读:bootstrap ”。

The funny thing is: When I delete the file "custom.css.scss" and refresh my browser, everything is fine (which means: bootstrap is used). 有趣的是:当我删除文件“custom.css.scss”并刷新我的浏览器时,一切都很好(这意味着:使用了bootstrap)。

Do you have any idea, what could be the reason? 你有什么想法,可能是什么原因?

Kindest regards Chris 最亲切的问候克里斯

PS: This is my installed gem file 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

The custom.css.scss file look like this 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;
}

I had a similar problem and saw Habax's solution and tried the last step first. 我遇到了类似的问题,看到了Habax的解决方案并首先尝试了最后一步。

I just restarted the server. 我刚刚重启了服务器。

That turned out to be enough. 结果证明是足够的。 Hope that helps. 希望有所帮助。

I had a similar issue, and I changed the file type from css to scss. 我遇到了类似的问题,我将文件类型从css更改为scss。 I bet if you erase '.css' from your file name it'll work. 我敢打赌,如果你从你的文件名中删除'.css'它会起作用。

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

facing same problem. 面临同样的问题。 I rename custom.css.scss to custom.css and I specified version of ruby in Gemfile. 我将custom.css.scss重命名为custom.css,并在Gemfile中指定了ruby版本。 and bundle install . 和捆绑安装。 in my case: ruby '2.0.0' 就我而言:ruby'2.0.0'

I had this same problem, solved by fixing bootstrap-sass and sass-rails versions to: 我有同样的问题,通过修复bootstrap-sass和sass-rails版本来解决:

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

And then bundle install and server restart. 然后bundle install和服务器重启。

I just want to past my resolution as a reference. 我只是想通过我的决议作为参考。 I have also encountered this issue today. 我今天也遇到过这个问题。 if you also using emacs with scss mode it may be helpful. 如果您还使用sccs模式的emacs,它可能会有所帮助。 as default when you save scss file emacs will auto-compile these scss file and create a responding .css file. 默认情况下,当您保存scss文件时,emacs将自动编译这些scss文件并创建响应的.css文件。 then you just need to delete these .css file. 那么你只需要删除这些.css文件。 or put below code to .emacs as permanent fix 或将以下代码放在.emacs作为永久修复

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

I got the same problem of "File to import not found or unreadable: bootstrap" in my scss file. 我在我的scss文件中遇到了“导入未找到或不可读的文件:bootstrap”的相同问题。 I just solved by adding require statement of "bootstrap-sass" to config.ru file. 我刚刚通过将“bootstrap-sass”的 require语句添加到config.ru文件来解决。 My config.ru is like the following. 我的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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 bootstrap:要导入的文件未找到或不可读 - bootstrap :File to import not found or unreadable 找不到要导入的文件或不可读的文件:引导链轮 - File to import not found or unreadable: bootstrap-sprockets 找不到导入文件或文件不可读:引导程序错误行#5 - File to import not found or unreadable: bootstrap error line #5 要导入的文件未找到或无法读取:bootstrap(Bootstrap、Rails、Sass 错误) - File to import not found or unreadable: bootstrap (Bootstrap, Rails, Sass error) Rails + Twitter Bootstrap:导入未找到或不可读的文件:twitter / bootstrap - Rails + Twitter Bootstrap: File to import not found or unreadable: twitter/bootstrap Bootstrap-Saas:找不到导入文件或不可读:bootstrap - Bootstrap-Saas: File to import not found or unreadable: bootstrap Ruby on Rails-导入Bootstrap错误“找不到文件或无法读取文件” - Ruby on Rails - import Bootstrap error “File not found or unreadable” 错误:找不到导入文件或不可读:引导链轮? - Error: File to import not found or unreadable: bootstrap-sprockets? 错误:找不到导入文件或不可读:bootstrap-sprockets - Error: File to import not found or unreadable: bootstrap-sprockets Sass::SyntaxError:找不到或无法读取要导入的文件:bootstrap-sprockets - Sass::SyntaxError: File to import not found or unreadable: bootstrap-sprockets
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM