在开发中 运行 rails 时链轮出现 `Errno::EExist` 错误
`Errno::EExist` error with sprockets when running rails in dev
我现在已经多次遇到这种情况,我希望有人可以提供一些关于以下错误的见解:
Errno::EEXIST at /
File exists @ 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
看来我的Google-fu今天很强。我发现了一张针对 Sprockets 3.6.0 的票据,该票据涉及不区分大小写的文件系统。参见 https://github.com/rails/sprockets/issues/283
(这是我的情况,无论如何,运行 vagrant 在 Windows 主机上)
遗憾的是,该项目的维护者似乎仍在讨论修复。
您可以尝试删除 tmp
文件夹,在主机的某处创建它并链接它。
rm -rf tmp
mkdir /tmp/rails-app
ln -s /tmp/rails-app tmp
我现在已经多次遇到这种情况,我希望有人可以提供一些关于以下错误的见解:
Errno::EEXIST at / File exists @ 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
看来我的Google-fu今天很强。我发现了一张针对 Sprockets 3.6.0 的票据,该票据涉及不区分大小写的文件系统。参见 https://github.com/rails/sprockets/issues/283
(这是我的情况,无论如何,运行 vagrant 在 Windows 主机上)
遗憾的是,该项目的维护者似乎仍在讨论修复。
您可以尝试删除 tmp
文件夹,在主机的某处创建它并链接它。
rm -rf tmp
mkdir /tmp/rails-app
ln -s /tmp/rails-app tmp