簡體   English   中英

找不到要導入的文件或不可讀的文件:引導鏈輪

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

我試圖將引導程序安裝到我的應用程序中,並且遇到各種問題。 我已經粘貼了我的gemfile,application.js和錯誤代碼。 我不確定我在這里做錯了什么,任何幫助將不勝感激。

styles.css.scss

// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
@import "bootstrap-sprockets";
@import "bootstrap";

寶石文件

source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
group :development do
  gem 'sqlite3'
  gem 'capistrano'
end

group :production do
  gem 'pg'
  gem 'mysql2'
  gem 'activerecord-mysql-adapter'
end

# Use SCSS for stylesheets
group :assets do
  gem 'coffee-rails'
  gem 'bootstrap-sass', '~> 3.3.3'
  gem 'sass-rails', '>= 3.2'

end
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views



# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# 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

# Use debugger
# gem 'debugger', group: [:development, :test]

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]

的application.js

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require bootstrap-sprockets

這是我的錯誤

WARN: tilt autoloading 'sass' in a non thread-safe way; explicit require 'sass' suggested.
Completed 500 Internal Server Error in 722ms

ActionView::Template::Error (File to import not found or unreadable: bootstrap-sprockets.
Load paths:
  C:/Sites/jeepjig/app/assets/images
  C:/Sites/jeepjig/app/assets/javascripts
  C:/Sites/jeepjig/app/assets/stylesheets
  C:/Sites/jeepjig/vendor/assets/javascripts
  C:/Sites/jeepjig/vendor/assets/stylesheets
  C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.2/lib/assets/javascripts
  C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/jquery-rails-3.1.2/vendor/assets/javascripts
  (in C:/Sites/jeepjig/app/assets/stylesheets/styles.css.scss:2)):
    3: <head>
    4:  <%= tag :meta, name: "viewport", content: "width=device-width, initial-scale=1.0" %>
    5:   <title>JeepJig</title>
    6:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
    7:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
    8:   <%= csrf_meta_tags %>
    9:
  app/assets/stylesheets/styles.css.scss:2
  app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__1034748832_48995988'


  Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templ
ates/rescues/_trace.html.erb (3.0ms)
  Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templ
ates/rescues/_request_and_response.html.erb (2.0ms)
  Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templ
ates/rescues/template_error.html.erb within rescues/layout (53.0ms)

更新:

我刪除了

group :assets do

現在我不再遇到錯誤。 我猜這在R4中已貶值

我找到了此鏈接,並很快意識到我遇到了問題,因為我安裝了boostrap-sass,並完成了捆綁安裝,而沒有重新啟動Rails服務器。

我希望向所有在這里找到自己的路而看不到為什么不起作用的其他人提供提醒。

刪除Gemfile中的group:assets,同時指定

gem 'bootstrap-sass', :git => 'https://github.com/twbs/bootstrap-sass.git', :branch => 'next'
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
gem 'autoprefixer-rails'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM