简体   繁体   English

Ruby on Rails错误“无法加载此类文件 - ”

[英]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-railstherubyracertwitter-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.

相关问题 Ruby on Rails:错误“require”:无法加载此类文件——bundler/setup (LoadError) - Ruby on Rails: Error `require': cannot load such file -- bundler/setup (LoadError) ruby 2.0 rails gem 安装错误“无法加载此类文件 — openssl” - ruby 2.0 rails gem install error “cannot load such file — openssl” Rails:引导程序更新后问题更少 - 无法加载此类文件 - Rails: Issue with less after bootstrap update — Cannot load such file — less 耙子流产了! 无法加载此类文件Ruby on Rails - rake aborted! cannot load such file Ruby on Rails Ruby on Rails:“无法加载此类文件”eventmachine - Ruby on Rails: “cannot load such file” eventmachine 无法加载此类文件— sqlite3 Ruby on Rails - Cannot Load Such File — sqlite3 Ruby on Rails ruby on rails-无法加载此类文件-serialport - ruby on rails - cannot load such file — serialport Ruby on rails - 无法加载这样的文件--net / ssh - Ruby on rails - cannot load such file — net/ssh Docker Ruby on Rails 容器无法加载此类文件 -- /..bundler-2.2.30/exe/bundle(加载错误) - Docker Ruby on Rails container cannot load such file -- /..bundler-2.2.30/exe/bundle (Load Error) Ruby on Rails新的应用程序错误:没有这样的文件加载 - Ruby on Rails new application error: no such file to load
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM