"require_tree参数必须是目录" Rails 3.1.1预编译资产 [英] "require_tree argument must be a directory" rails 3.1.1 precompile assets

查看:168
本文介绍了"require_tree参数必须是目录" Rails 3.1.1预编译资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在这里尝试使资产在我的生产服务器上进行预编译(使用ruby 1.9.2和Rails 3.1.1进行直接的ubuntu安装,并尝试使用新的链轮2.10进行3.1.2RC以及).

I've been round and round here with trying to get the assets to pre-compile on my production server (straightforward ubuntu install with ruby 1.9.2 and Rails 3.1.1, and tried 3.1.2RC with the new sprockets 2.10 as well).

"require_tree参数必须是目录".我已经在堆栈上看到了与此相关的其他问题,但情况并不完全相同,所提出的解决方案也无济于事-例如在子文件夹中创建存根文件,然后仅在那时进行相对引用.没运气.

"require_tree argument must be a directory". I've seen other issues related to this on stack but the situation isn't exactly the same and none of the proposed solutions have helped – like create a stub file in the sub folder, then reference only relatively at that point. No luck.

最重要的是,它当然可以在生产环境中的所有开发机器(mac机,但具有相同的配置,甚至gem与gem匹配)上完美运行.

And to top it off, of course this works perfectly on all development machines (mac's but with identical configs, even matching gem for gem), in production env.

这是我的/app/assets/javascript/application.js:

Here is my /app/assets/javascript/application.js:

//= require ../../views/app/manifest
//= require_self

不多.基本上只是指向应用程序区域的真实清单文件(是的,不是盒装香草Rails,而是...)

Not much to it. Basically just pointing to the real manifest file for the app area (yeah, not exactly boxed vanilla Rails but...)

这是我在views/admin(/views/app/manifest.coffee.js)中的存根清单:

Here is my stub manifest in my views/admin (/views/app/manifest.coffee.js):

# = require ./app
# = require_tree ./models
# = require_directory ./views <- or using require_directory, either would work fine.

就像我说的那样,在开发环境中根本没有问题.资产管道可以即时编译,一切都很好.运行中,掠夺资产:在开发机器上预编译,也没有问题.

Like I said, in dev env, no issues at all. The asset pipeline compiles on the fly and everything is great. Running, rake assets:precompile on the dev machine, no issues either.

我将其发送到生产机器并运行完全相同的代码,然后得到:

I send it up to the production machine and run the exact same code and I get:

require_tree参数必须是目录

require_tree argument must be a directory

在这里我只是没有看到微小的细微差别.任何帮助将不胜感激!

There has to be some tiny tiny difference here that I'm just not seeing. Any help would be much appreciated!

推荐答案

我遇到了与您描述的完全相同的问题.我的生产服务器是Heroku(雪松堆栈).就我而言,问题是我的其中之一:

I ran into this exact same issue you described. My production server was Heroku (cedar stack). In my case the issue was that one of my:

require_tree ./mobile

指向合法目录,但是该目录没有文件.在开发人员上,这没关系,但是有关生产设置的问题导致了错误,"require_tree参数必须是目录".

Was pointing to a legitimate directory, but this directory had no files. On dev it didn't matter but something about the production setup was resulting in the error, "require_tree argument must be a directory".

希望这会有所帮助.

这篇关于"require_tree参数必须是目录" Rails 3.1.1预编译资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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