Bootstrap-sprockets 错误:未找到或无法读取要导入的文件:bootstrap-sprockets [英] Bootstrap-Sprockets Error: File to import not found or unreadable: bootstrap-sprockets

查看:60
本文介绍了Bootstrap-sprockets 错误:未找到或无法读取要导入的文件:bootstrap-sprockets的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的应用程序中实施引导程序,但我不断收到一些我以前在启动应用程序时从未收到过的错误.我浏览了一个答案,我一直找到的唯一答案是删除我没有的 Gemfile 的 assets 部分,并重新启动服务器,我已经多次完成但没有成功.以下是错误和我的文件.如果需要提供其他东西,请告诉我.谢谢!

浏览器错误:未找到或无法读取要导入的文件:bootstrap-sprockets

Rails 服务器警告:

/Users/tucker/.rvm/gems/ruby-2.2.1/gems/bootstrap-sass-3.3.6/lib/bootstrap-sass/version.rb:2: 警告:已初始化常量 Bootstrap::版本/Users/tucker/.rvm/gems/ruby-2.2.1/gems/bootstrap-4.0.0.alpha3/lib/bootstrap/version.rb:2: 警告:VERSION 的先前定义在这里/Users/tucker/.rvm/gems/ruby-2.2.1/gems/bootstrap-sass-3.3.6/lib/bootstrap-sass/version.rb:3:警告:已初始化常量 Bootstrap::BOOTSTRAP_SHA/Users/tucker/.rvm/gems/ruby-2.2.1/gems/bootstrap-4.0.0.alpha3/lib/bootstrap/version.rb:3:警告:BOOTSTRAP_SHA的先前定义在这里

Gemfile:

source 'https://rubygems.org'宝石导轨",4.2.5"组:生产做宝石'pg'宝石'rails_12factor'结尾组:开发做宝石'sqlite3'结尾gem 'sass-rails', '~>5.0'gem 'uglifier', '>= 1.3.0'gem '咖啡轨','~>4.1.0'宝石'jquery-rails'宝石涡轮链接"宝石引导"宝石费加罗"宝石撬"gem 'jbuilder', '~>2.0'gem 'sdoc', '~>0.4.0', 组: :docgem 'bootstrap-sass'组:开发,:测试做宝石'再见'gem '网络控制台', '~>2.0'宝石春天"gem 'rspec-rails'宝石应该"宝石伪造者"宝石 'factory_girl_rails'结尾

Application.js:

//= 需要 jquery//= 需要引导链轮//= 需要 jquery_ujs//= 需要涡轮链接//= require_tree .

Application.scss:

<预><代码>...*= require_tree .*= require_self*/@import "bootstrap-sprockets";@import "引导程序";

解决方案

我看到你的 gemfile 中有 gem 'bootstrap'gem 'bootstrap-sass'.如果您删除其中之一,运行 bundle 并按照相应 github 站点上的安装说明进行操作,那么链轮应该可以工作.另外我的 application.scss 文件通常没有 require 部分.

I'm attempting to implement bootstrap into my app and I keep getting a couple errors that I've never received when starting apps before. I browsed for an answer and the only answers I keep finding are to remove the assets part of the Gemfile which I don't have and to restart the server which I've done several times with no luck. Below are the errors and my files. Please let me know if something else needs to be provided. Thank you!

Browser Error: File to import not found or unreadable: bootstrap-sprockets

Rails Server Warnings:

/Users/tucker/.rvm/gems/ruby-2.2.1/gems/bootstrap-sass-3.3.6/lib/bootstrap-sass/version.rb:2: warning: already initialized constant Bootstrap::VERSION
/Users/tucker/.rvm/gems/ruby-2.2.1/gems/bootstrap-4.0.0.alpha3/lib/bootstrap/version.rb:2: warning: previous definition of VERSION was here
/Users/tucker/.rvm/gems/ruby-2.2.1/gems/bootstrap-sass-3.3.6/lib/bootstrap-sass/version.rb:3: warning: already initialized constant Bootstrap::BOOTSTRAP_SHA
/Users/tucker/.rvm/gems/ruby-2.2.1/gems/bootstrap-4.0.0.alpha3/lib/bootstrap/version.rb:3: warning: previous definition of BOOTSTRAP_SHA was here

Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.5'

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

group :development do
  gem 'sqlite3'
end

gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'bootstrap'
gem 'figaro'
gem 'pry'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bootstrap-sass'

group :development, :test do
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  gem 'spring'
  gem 'rspec-rails'
  gem 'shoulda'
  gem 'faker'
  gem 'factory_girl_rails'
end

Application.js:

//= require jquery
//= require bootstrap-sprockets
//= require jquery_ujs
//= require turbolinks
//= require_tree .

Application.scss:

...

*= require_tree .
 *= require_self
 */

@import "bootstrap-sprockets";
@import "bootstrap";

解决方案

I see you have gem 'bootstrap' and gem 'bootstrap-sass' in your gemfile. If you delete one of them, run bundle and follow the installation instructions on the respective github site then the sprockets should work. Also mine application.scss file is usually without the require part.

这篇关于Bootstrap-sprockets 错误:未找到或无法读取要导入的文件:bootstrap-sprockets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆