由于某种原因,bin read无法从标准资源目录中读取图像文件,并且失败并显示以下消息:
C:\Users\username\Documents\project>bundle exec rake assets:precompile
RAILS_ENV=development --trace
DL is deprecated, please use Fiddle
DL is deprecated, please use Fiddle
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
I, [2015-08-20T16:43:52.031167 #2664] INFO -- : Writing C:/Users/username/Documents/project/public/assets/xxx-5e3812eb433519f2816f938f5c3512a8a272644bd73273a3680ceb6f625b701a.png
rake aborted!
Errno::EINVAL: Invalid argument @ rb_sysopen - C:/Users/username/Documents/project/C:/Users/username/Documents/project/app/assets/images/xxx.png
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/asset.rb:99:in `binread'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/asset.rb:99:in `source'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/asset.rb:166:in `block in write_to'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:274:in `block in atomic_write'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:273:in `open'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:273:in `atomic_write'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/asset.rb:165:in `write_to'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/manifest.rb:186:in `block in compile'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/manifest.rb:139:in `block (2 levels) in find'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/base.rb:76:in `find_all_linked_assets'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/manifest.rb:138:in `block in find'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:223:in `block in stat_tree'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:207:in `block in stat_directory'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:204:in `each'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:204:in `stat_directory'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/path_utils.rb:222:in `stat_tree'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/legacy.rb:105:in `each'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/legacy.rb:104:in `each'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/legacy.rb:104:in `logical_paths'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/manifest.rb:136:in `find'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/sprockets/manifest.rb:162:in `compile'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-3.3.2/lib/rake/sprocketstask.rb:147:in `with_logger'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in`<top (required)>'
C:/RailsInstaller/Ruby2.1.0/bin/rake:23:in `load'
C:/RailsInstaller/Ruby2.1.0/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile
答案 0 :(得分:0)
我找到了解决方案:事实证明,sprockets gem中的内部资产缓存以某种方式损坏了文件名,因此实际图像文件的链接导致异常。使用以下应用程序配置设置刷新缓存并克服此问题:#资产的版本,如果要使所有资产到期,请更改此设置config.assets.version ='v.2'