[英]Ruby on Rails error “cannot load such file — less”
I am fairly new to ruby on rails
, I have been trying to use twitter-bootstrap
as an asset, so I have included it in my Gemfile, bundled and it installs successfully. 我
ruby on rails
上的ruby on rails
相当新,我一直在尝试使用twitter-bootstrap
作为资产,因此我将它包含在我的Gemfile中,捆绑并成功安装。 However I have noticed that it relies on certain dependencies that are not shown when I do the "bundle" command. 但是我注意到它依赖于我执行“bundle”命令时未显示的某些依赖项。
The dependences it needs 它需要的依赖性
(1) Libv8
(2) Less
(3) Less-rails
Error message: 错误信息:
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'
I have noticed a lot of answers to this very question already, and have chosen the obvious solutions, but somehow I still get stuck, and would really appreciate some guidance. 我已经注意到了很多这个问题的答案,并选择了明显的解决方案,但不知何故我仍然陷入困境,并且非常感谢一些指导。
I guess you are using sass instead of LESS. 我猜你使用sass而不是LESS。
Have you tried the twitter-bootstrap-rails gem? 你试过twitter-bootstrap-rails gem吗?
gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"
https://github.com/seyhunak/twitter-bootstrap-rails https://github.com/seyhunak/twitter-bootstrap-rails
I simply needed to restart my server. 我只需要重启我的服务器。
I had added the three gems listed above ( less-rails
, therubyracer
, and twitter-bootstrap-rails
, with Rails 3.2.13 ) while my local server was running, resulting in the problem seen above. 我在本地服务器运行时添加了上面列出的三个宝石(
less-rails
, therubyracer
和twitter-bootstrap-rails
,使用Rails 3.2.13 ),导致上面出现的问题。 So once I shut it down and restarted it again, everything loaded well. 因此,一旦我关闭它并重新启动它,一切都很好。
You have to either update therubyracer
or downgrade the twitter-bootstrap-rails
gem down to version 2.1.7 which is the last known version that didn't have this issue. 您必须更新
therubyracer
或将twitter-bootstrap-rails
gem降级到版本2.1.7,这是最后一个没有此问题的已知版本。
Run either bundle update
to update your gems or in your Gemfile
make your twitter-bootstrap-rails gem look like this: 运行
bundle update
以更新你的gem或在你的Gemfile
你的twitter-bootstrap-rails gem看起来像这样:
gem 'twitter-bootstrap-rails', '2.1.7'
Take a look at this issue: 看看这个问题:
https://github.com/seyhunak/twitter-bootstrap-rails/issues/465 https://github.com/seyhunak/twitter-bootstrap-rails/issues/465
This issue started happening on versions after 2.1.7 on twitter-bootstrap-rails
. 此问题在
twitter-bootstrap-rails
上的2.1.7之后的版本上开始发生。
If you are getting it under Windows this should help you therubyracer_for_windows 如果你在Windows下获得它,这应该可以帮助你therubyracer_for_windows
It helped me 它帮助了我
也许你在Windows上...没有libv8 for windows和没有二进制therubyracer因为它依赖于libv8
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.