Keith
Keith

Reputation: 1494

`Errno::EExist` error with sprockets when running rails in dev

This has happened to me on multiple occassions now and I was hoping someone could provide some insight into the the following error:

Errno::EEXIST at / File exists @ dir_s_mkdir - tmp/cache/assets/sprockets/v3.0/Pd

Here's the associated stack trace:

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'

It appears it's failing to create a random subdirectory in tmp/cache in order to cache the on the fly compiled assets (I'm running in development mode). However, the directory shown in the error message does not exist.

Clearing the temp cache and restarting rails doesn't resolve the issue. The only way I've been able to get around this is to start another rails application on the same system somewhere else. After that comes up, I kill it and restart the failing app and it works again. There's no real evidence to suggest that's an actual work around or if it's just a coincidence.

Anyways, I would love to hear from anyone else who has experienced this before or if someone might be able to shed some light on why this is happening.

Thanks.

Upvotes: 3

Views: 4505

Answers (2)

Mirko Akov
Mirko Akov

Reputation: 2447

You can try deleting the tmp folder, creating it somewhere in the host and linking it.

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

Upvotes: 3

Hovis Biddle
Hovis Biddle

Reputation: 889

Apparently my Google-fu is strong today. I found a ticket filed against Sprockets 3.6.0 that relates to case-insensitive filesystems. See https://github.com/rails/sprockets/issues/283

(This is my case, anyway, running vagrant on a Windows host)

Regretfully, it seems that the maintainers of the project are still discussing a fix.

Upvotes: 6

Related Questions