在dev中运行rails时,sprockets出现“Errno :: EExist`错误

时间:2016-07-07 18:06:20

标签: ruby-on-rails-4 asset-pipeline assets sprockets

现在我在多个场合发生过这种情况,我希望有人可以对以下错误提供一些见解:

  

Errno :: EEXIST at /   文件存在@ dir_s_mkdir - tmp / cache / assets / sprockets / v3.0 / Pd

这是相关的堆栈跟踪:

Errno::EEXIST - File exists @ dir_s_mkdir - /home/dev/keithgw-dev/code/myapp/tmp/cache/assets/sprockets/v3.0/Pd:
() opt/rubies/ruby-2.2.2/lib64/ruby/2.2.0/fileutils.rb:252:in `fu_mkdir'
() opt/rubies/ruby-2.2.2/lib64/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p'
() opt/rubies/ruby-2.2.2/lib64/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p'
() opt/rubies/ruby-2.2.2/lib64/ruby/2.2.0/fileutils.rb:210:in `mkdir_p'
sprockets (3.6.0) lib/sprockets/cache/file_store.rb:85:in `set'
sprockets (3.6.0) lib/sprockets/cache.rb:212:in `set'
sprockets (3.6.0) lib/sprockets/cache.rb:136:in `set'
sprockets (3.6.0) lib/sprockets/loader.rb:321:in `fetch_asset_from_dependency_cache'
sprockets (3.6.0) lib/sprockets/loader.rb:44:in `load'
sprockets (3.6.0) lib/sprockets/cached_environment.rb:20:in `block in initialize'
sprockets (3.6.0) lib/sprockets/cached_environment.rb:47:in `load'
sprockets (3.6.0) lib/sprockets/base.rb:66:in `find_asset'
sprockets (3.6.0) lib/sprockets/base.rb:73:in `find_all_linked_assets'
sprockets (3.6.0) lib/sprockets/manifest.rb:142:in `block in find'
sprockets (3.6.0) lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
sprockets (3.6.0) lib/sprockets/path_utils.rb:223:in `block in stat_tree'
sprockets (3.6.0) lib/sprockets/path_utils.rb:207:in `block in stat_directory'
sprockets (3.6.0) lib/sprockets/path_utils.rb:204:in `stat_directory'
sprockets (3.6.0) lib/sprockets/path_utils.rb:222:in `stat_tree'
sprockets (3.6.0) lib/sprockets/legacy.rb:105:in `block in logical_paths'
sprockets (3.6.0) lib/sprockets/legacy.rb:104:in `logical_paths'
sprockets (3.6.0) lib/sprockets/manifest.rb:140:in `find'
sprockets-rails (3.0.4) lib/sprockets/railtie.rb:49:in `precompiled_assets'
sprockets-rails (3.0.4) lib/sprockets/railtie.rb:34:in `asset_precompiled?'
sprockets-rails (3.0.4) lib/sprockets/railtie.rb:214:in `block (3 levels) in <class:Railtie>'
sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:345:in `precompiled?'
sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:349:in `raise_unless_precompiled_asset'
sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:334:in `find_debug_asset'
sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:216:in `block in lookup_debug_asset'
sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:229:in `block in resolve_asset'
sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:228:in `resolve_asset'
sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:215:in `lookup_debug_asset'
sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:157:in `block in stylesheet_link_tag'
sprockets-rails (3.0.4) lib/sprockets/rails/helper.rb:156:in `stylesheet_link_tag'
() home/dev/keithgw-dev/code/myapp/app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb__3086746537636264556_24830040'

它似乎无法在tmp/cache中创建一个随机子目录,以便缓存即时编译资产(我在development模式下运行)。但是,错误消息中显示的目录存在。

清除临时缓存并重新启动rails并不能解决问题。我能够解决这个问题的唯一方法是在其他地方的同一系统上启动另一个rails应用程序。在那之后,我杀了它并重新启动失败的应用程序,它再次工作。没有真正的证据表明这是一个实际的工作,或者它只是巧合。

无论如何,我很乐意听到之前经历过这种情况的其他人的消息,或者是否有人能够阐明为什么会发生这种情况。

感谢。

  • Rails - 4.2.6
  • Ruby - 2.2.2

2 个答案:

答案 0 :(得分:2)

显然我的谷歌今天很强大。我找到了一个针对Sprockets 3.6.0提交的与案例不敏感的文件系统相关的票据。见https://github.com/rails/sprockets/issues/283

(无论如何,这是我的情况,在Windows主机上运行流浪汉)

遗憾的是,该项目的维护者似乎仍在讨论解决方案。

答案 1 :(得分:0)

您可以尝试删除tmp文件夹,在主机中的某处创建并链接它。

rm -rf tmp
mkdir /tmp/rails-app
ln -s /tmp/rails-app tmp