首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Ruby on Rails错误“无法加载这样的文件-- less”

Ruby on Rails错误“无法加载这样的文件-- less”
EN

Stack Overflow用户
提问于 2012-12-15 09:12:33
回答 5查看 35.1K关注 0票数 41

我是ruby on rails的新手,我一直在尝试使用twitter-bootstrap作为一种资产,所以我已经将它包含在我的Gemfile中,捆绑并成功安装了它。然而,我注意到它依赖于某些依赖项,而这些依赖项在我执行"bundle“命令时没有显示出来。

它需要的依赖项

代码语言:javascript
运行
复制
(1) Libv8
(2) Less
(3) Less-rails

错误消息:

代码语言:javascript
运行
复制
cannot load such file -- less
  (in c:/Sites/todo/app/assets/stylesheets/bootstrap_and_overrides.css.less)

[code]

Extracted source (around line #8):

5:   <!--[if lt IE 9]>
6:     <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"     type="text/javascript"></script>
7:   <![endif]-->
8:   <%= stylesheet_link_tag    "application", :media => "all" %>
9:   <%= javascript_include_tag "application" %>
10:   <%= csrf_meta_tags %>
11:   <meta name="viewport" content="width=device-width, initial-scale=1.0">

[/code]

Trace
app/views/layouts/application.html.erb:8:in     `_app_views_layouts_application_html_erb__560528188_27183396'
app/controllers/lists_controller.rb:7:in `index'

我已经注意到这个问题的许多答案,并选择了显而易见的解决方案,但不知何故我仍然被卡住了,真的希望得到一些指导。

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2012-12-15 09:23:40

我猜你是在使用sass而不是LESS。

你有没有尝试过twitter-bootstrap-rails这个gem?

代码语言:javascript
运行
复制
gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"

https://github.com/seyhunak/twitter-bootstrap-rails

票数 89
EN

Stack Overflow用户

发布于 2013-08-08 11:35:34

我只需要重新启动我的服务器。

在我的本地服务器运行时,我添加了上面列出的三个gem (less-railstherubyracertwitter-bootstrap-rails,使用Rails 3.2.13),导致了上面看到的问题。因此,一旦我关闭并重新启动它,一切都加载得很好。

票数 27
EN

Stack Overflow用户

发布于 2012-12-15 09:28:42

您必须要么更新therubyracer,要么将twitter-bootstrap-rails gem降级到2.1.7版,这是已知的最后一个没有这个问题的版本。

运行bundle update更新你的gem,或者在你的Gemfile中让你的twitter-bootstrap-rails gem看起来像这样:

代码语言:javascript
运行
复制
gem 'twitter-bootstrap-rails', '2.1.7'

看一下这个问题:

https://github.com/seyhunak/twitter-bootstrap-rails/issues/465

此问题开始出现在twitter-bootstrap-rails上2.1.7之后的版本中。

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13888381

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档