rails/sass-rails — Issue #86: Precompiling raises nil value for config.assets_dir
Author: dewski
Created: 2012-01-06 19:04:46+00:00
State: open

After having some major issues over the past few weeks trying to get this to compile on Heroku, I ran into a new issue.

Previously #85, [sprockets/270](https://github.com/sstephenson/sprockets/issues/270), and other rails related issues were the cause of those.

Now during precompiling it will error out saying `can't convert nil into String` which points to `ActionView::AssetPaths` on line 36. I inserted a `puts config.assets_dir` which returns nil. I have a feeling sass-rails isn't passing in the correct config, but I am still investigating myself.

```
module ActionView
class AssetPaths #:nodoc:

# ...

# Return the filesystem path for the source
def compute_source_path(source, dir, ext)
source = rewrite_extension(source, dir, ext) if ext
puts config.assets_dir # => nil
File.join(config.assets_dir, dir, source)
end

# ...
end
end
```

I have attached the tracelog and my `bundle list` output to help.

The output of the rake task:

```
dewski ~/work/rails/site (master)
$ RAILS_ENV=development bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/dewski/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/dewski/.rvm/gems/ruby-1.9.2-p290/bin/rake assets:precompile:all RAILS_ENV=development RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
can't convert nil into String
(in /Users/dewski/work/rails/site/app/assets/stylesheets/application.css.scss)
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0.rc2/lib/action_view/asset_paths.rb:37:in `join'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0.rc2/lib/action_view/asset_paths.rb:37:in `compute_source_path'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sass-rails-3.2.3/lib/sass/rails/template_handlers.rb:23:in `source_path'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sass-rails-3.2.3/lib/sass/rails/template_handlers.rb:84:in `sass_options'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sass-rails-3.2.3/lib/sass/rails/template_handlers.rb:106:in `evaluate'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/context.rb:177:in `block in evaluate'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/context.rb:174:in `each'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/context.rb:174:in `evaluate'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/processed_asset.rb:12:in `initialize'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:241:in `new'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:241:in `block in build_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:262:in `circular_call_protection'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:240:in `build_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/index.rb:89:in `block in build_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/index.rb:88:in `build_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:163:in `find_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/index.rb:56:in `find_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/bundled_asset.rb:16:in `initialize'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:244:in `new'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:244:in `build_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/index.rb:89:in `block in build_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/index.rb:88:in `build_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:163:in `find_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/index.rb:56:in `find_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/environment.rb:74:in `find_asset'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0.rc2/lib/sprockets/static_compiler.rb:20:in `block in compile'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:212:in `block in each_logical_path'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:200:in `block (2 levels) in each_file'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:190:in `each'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:190:in `each_entry'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:198:in `block in each_file'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:197:in `each'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:197:in `each_file'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/sprockets-2.1.2/lib/sprockets/base.rb:210:in `each_logical_path'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0.rc2/lib/sprockets/static_compiler.rb:18:in `compile'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0.rc2/lib/sprockets/assets.rake:52:in `internal_precompile'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0.rc2/lib/sprockets/assets.rake:66:in `block (3 levels) in '
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/dewski/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0.rc2/lib/sprockets/assets.rake:56:in `block (3 levels) in '
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/dewski/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `

'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/Users/dewski/.rvm/rubies/ruby-1.9.2-p290/...]
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils.rb:80:in `ruby'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0.rc2/lib/sprockets/assets.rake:9:in `ruby_rake_task'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0.rc2/lib/sprockets/assets.rake:17:in `invoke_or_reboot_rake_task'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.0.rc2/lib/sprockets/assets.rake:25:in `block (2 levels) in '
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/dewski/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/dewski/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `

'
Tasks: TOP => assets:precompile
```

Bundle list:
```
dewski ~/work/rails/site (master)
$ bundle list
Gems included by the bundle:
* actionmailer (3.2.0.rc2)
* actionpack (3.2.0.rc2)
* activemodel (3.2.0.rc2)
* activerecord (3.2.0.rc2)
* activeresource (3.2.0.rc2)
* activesupport (3.2.0.rc2)
* addressable (2.2.6)
* airbrake (3.0.3)
* arel (3.0.0.rc1)
* aws-s3 (0.6.2)
* bcrypt-ruby (3.0.1)
* bkwld-paper_trail (2.3.3)
* bson (1.3.1)
* bson_ext (1.3.1)
* builder (3.0.0)
* bundler (1.1.rc.6)
* cancan (1.6.5)
* capistrano (2.9.0)
* capistrano-ext (1.2.1)
* capistrano_colors (0.5.5)
* chunky_png (1.2.5)
* client_side_validations (3.1.0)
* cocaine (0.2.1)
* coffee-rails (3.2.1)
* coffee-script (2.2.0)
* coffee-script-source (1.2.0)
* compass (0.12.alpha.4)
* crack (0.3.1)
* dalli (1.1.4)
* devise (1.4.7)
* differ (0.1.2)
* erubis (2.7.0)
* escape (0.0.4)
* execjs (1.2.13)
* flash_cookie_session (1.1.0)
* formtastic (2.0.0.rc3)
* fssm (0.2.8.1)
* garb (0.9.1)
* haml (3.1.4)
* haml-rails (0.3.4)
* hashie (1.2.0)
* heroku (2.17.0)
* highline (1.6.9)
* hike (1.2.1)
* hipchat (0.4.1)
* httparty (0.8.1)
* i18n (0.6.0)
* journey (1.0.0.rc4)
* jquery-rails (2.0.0)
* json (1.6.4)
* kaminari (0.12.4)
* kgio (2.7.0)
* kss (0.1.3)
* kss-rails (1.0 a9b953d)
* launchy (2.0.5)
* mail (2.3.0)
* mail_view (1.0.1 a99c2fc)
* mime-types (1.17.2)
* mongo (1.3.1)
* mongoid (2.4.0)
* multi_json (1.0.4)
* multi_xml (0.4.1)
* mysql2 (0.3.11)
* net-scp (1.0.4)
* net-sftp (2.0.5)
* net-ssh (2.2.2)
* net-ssh-gateway (1.1.0)
* nokogiri (1.5.0)
* orm_adapter (0.0.5)
* paperclip (2.4.5)
* paperclip-meta (0.2)
* pg (0.12.2)
* polyglot (0.3.3)
* pr_geohash (1.0.0)
* producer (0.1.0 02555d4)
* rack (1.4.0)
* rack-cache (1.1)
* rack-protection (1.2.0)
* rack-ssl (1.3.2)
* rack-test (0.6.1)
* rails (3.2.0.rc2)
* rails-footnotes (3.7.5)
* railties (3.2.0.rc2)
* raindrops (0.8.0)
* rake (0.9.2.2)
* rash (0.3.2)
* rdiscount (1.6.8)
* rdoc (3.12)
* redis (2.2.2)
* redis-namespace (1.0.3)
* resque (1.19.0 af5a9a8)
* rest-client (1.6.7)
* rsolr (1.0.6)
* rubyzip (0.9.5)
* sass (3.1.12)
* sass-rails (3.2.3)
* sinatra (1.3.2)
* sprockets (2.1.2)
* sunspot (1.3.0)
* sunspot_rails (1.3.0)
* sunspot_solr (1.3.0)
* term-ansicolor (1.0.7)
* thor (0.14.6)
* tilt (1.3.3)
* treetop (1.4.10)
* tzinfo (0.3.31)
* uglifier (1.2.1)
* unicorn (4.1.1)
* vegas (0.1.8)
* warden (1.0.6)
* xml-simple (1.1.1)
* zencoder (2.4.0)
```