2011-08-29 72 views
0

我試圖獲得一個全新的骨架應用程序在rails 3.1.0.rc8中運行。但是,無論何時在視圖中使用任何資產標籤/幫助程序(例如image_tag,javascript_include_tag等),我都會收到資產編譯錯誤。當我直接請求/assets/rails.png時,以下是我的logs/development.log片段。新的Rails應用程序加載資產失敗

Started GET "/assets/rails.png" for 192.168.0.12 at Mon Aug 29 16:16:21 -0600 2011 
Error compiling asset rails.png: 
ArgumentError: wrong number of arguments (2 for 1) 

activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `respond_to?' 
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `dump' 
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `write_entry' 
activesupport (3.1.0.rc8) lib/active_support/core_ext/file/atomic.rb:20:in `atomic_write' 
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `write_entry' 
activesupport (3.1.0.rc8) lib/active_support/cache/strategy/local_cache.rb:140:in `write_entry' 
activesupport (3.1.0.rc8) lib/active_support/cache.rb:364:in `write' 
activesupport (3.1.0.rc8) lib/active_support/cache.rb:520:in `instrument' 
activesupport (3.1.0.rc8) lib/active_support/cache.rb:362:in `write' 
sprockets (2.0.0.beta.15) lib/sprockets/caching.rb:117:in `cache_set' 
sprockets (2.0.0.beta.15) lib/sprockets/caching.rb:80:in `cache_set_hash' 
sprockets (2.0.0.beta.15) lib/sprockets/caching.rb:51:in `cache_asset' 
sprockets (2.0.0.beta.15) lib/sprockets/environment.rb:82:in `build_asset' 
sprockets (2.0.0.beta.15) lib/sprockets/trail.rb:102:in `find_asset_in_path' 
sprockets (2.0.0.beta.15) lib/sprockets/base.rb:102:in `find_asset' 
sprockets (2.0.0.beta.15) lib/sprockets/environment.rb:72:in `find_asset' 
sprockets (2.0.0.beta.15) lib/sprockets/server.rb:42:in `call' 
rack-mount (0.8.2) lib/rack/mount/prefix.rb:26:in `call' 
rack-mount (0.8.2) lib/rack/mount/route_set.rb:152:in `call' 
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:96:in `recognize' 
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:68:in `optimized_each' 
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:95:in `recognize' 
rack-mount (0.8.2) lib/rack/mount/route_set.rb:141:in `call' 
actionpack (3.1.0.rc8) lib/action_dispatch/routing/route_set.rb:531:in `call' 
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' 
rack (1.3.2) lib/rack/etag.rb:23:in `call' 
rack (1.3.2) lib/rack/conditionalget.rb:25:in `call' 
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/head.rb:14:in `call' 
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/params_parser.rb:21:in `call' 
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/flash.rb:243:in `call' 
rack (1.3.2) lib/rack/session/abstract/id.rb:195:in `context' 
rack (1.3.2) lib/rack/session/abstract/id.rb:190:in `call' 
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/cookies.rb:326:in `call' 
activerecord (3.1.0.rc8) lib/active_record/query_cache.rb:62:in `call' 
activerecord (3.1.0.rc8) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call' 
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/callbacks.rb:29:in `call' 
activesupport (3.1.0.rc8) lib/active_support/callbacks.rb:392:in `_run_call_callbacks' 
activesupport (3.1.0.rc8) lib/active_support/callbacks.rb:81:in `send' 
activesupport (3.1.0.rc8) lib/active_support/callbacks.rb:81:in `run_callbacks' 
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/callbacks.rb:28:in `call' 
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/reloader.rb:68:in `call' 
rack (1.3.2) lib/rack/sendfile.rb:101:in `call' 

我運行紅寶石1.8.7和乘客,如果相關。其他人遇到這個錯誤?

+1

你還在用Sprockets 2.0.0得到這個嗎? –

+0

啊,從2.0.0.beta.15升級到Sprockets 2.0.0。現在一切都很開心。謝謝瑞恩! – dhulihan

回答

0

通過升級從鏈輪2.0.0.beta.15到2.0.0修正了這一點:

gem install sprockets -v=2.0.0 

榮譽給Ryan Bigg的幫助。

0

我通過rake任務編制資產時遇到了同樣的問題:花費4小時以上後

$ bundle exec rake assets:precompile --trace 
... 
** Execute assets:precompile:primary 
rake aborted! 
wrong number of arguments (2 for 1) 
/usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.0/lib/active_support/cache/file_store.rb:91:in `respond_to?' 
/usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.0/lib/active_support/cache/file_store.rb:91:in `dump' 
... 

,並嘗試了很多方法,我發現,它可能是紅寶石的問題。 (從這個鏈接:https://github.com/resolve/refinerycms/issues/538

$ ruby -v 
ruby 1.8.7 (2008-05-31 patchlevel 0) 

這裏patchlevel 0是問題。因爲我的ruby是從源代碼編譯的。 (某些原因,我無法從包管理器或通過RVM進行安裝)。

解決方案:

  1. 下載從http://ftp.ruby-lang.org/pub/ruby/1.8/新的源文件,例如補丁358,
  2. 編譯:

    unzip ruby-1.8.7-p358.zip -d /tmp && cd /tmp/ruby-1.8.7-p358 && ./configure && make && sudo make install 
    
  3. 紅寶石現在有一個新的版本:補丁358

    $ ruby -v 
    ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-linux] 
    

    和一切正常!

相關問題