twitter-bootstrap 无法运行 bootsrap:找不到类型为“application/javascript”的文件“bootstrap-sprockets”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31371040/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 22:56:43  来源:igfitidea点击:

Can't run bootsrap : couldn't find file 'bootstrap-sprockets' with type 'application/javascript'

cssruby-on-railstwitter-bootstrapsass

提问by icecreamrabbit

Having some problems installing bootstrap onto my rails project.

在我的 Rails 项目上安装引导程序时遇到一些问题。

howing /Users/muhname/Photogur/app/views/layouts/application.html.erb where line #10 raised:

如何 /Users/muhname/Photogur/app/views/layouts/application.html.erb 其中第 10 行提出:

couldn't find file 'bootstrap-sprockets' with type 'application/javascript'

找不到类型为“application/javascript”的文件“bootstrap-sprockets”

my application.js file:

我的 application.js 文件:

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

my css:

我的CSS:

/  *= require bootstrap_and_overrides
/  *= require_tree .
/  *= require_self
/ /*

@import "bootstrap"

gem: 'bootstrap-sass', '3.0.2.1'

宝石:'bootstrap-sass','3.0.2.1'

Anybody who might know what the issue is? thanks!

有谁可能知道这是什么问题?谢谢!

回答by Elvn

Try removing bootstrap-sprockets from your application.js. It doesn't need to be there, and it's creating the error.

尝试从 application.js 中删除 bootstrap-sprockets。它不需要在那里,它正在创造错误。

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

回答by tzurcan

I had the same issue:

我遇到过同样的问题:

couldn't find file 'bootstrap-sprockets' with type 'application/javascript'

找不到类型为“application/javascript”的文件“bootstrap-sprockets”

The only solution was to comment off:

唯一的解决方案是注释掉:

# gem 'sass-rails', '~> 5.0' 

And add instead:

并添加:

gem 'sass-rails', '>= 3.2'

In the Gemfile, I hope this helps other members.

在 中Gemfile,我希望这可以帮助其他成员。

回答by Sandra

I had a similar error:

我有一个类似的错误:

couldn't find file 'bootstrap-material-design.js' with type 'application/javascript'

找不到类型为“application/javascript”的文件“bootstrap-material-design.js”

and I can fix removing this line in application.js

我可以修复在 application.js 中删除这一行

//=require bootstrap-material-design.js

Try it!

试试看!