pitr / angular-rails-templates

Use your angular templates with rails' asset pipeline
https://rubygems.org/gems/angular-rails-templates
MIT License
566 stars 169 forks source link

NoMethodError: undefined method `bytesize' for nil:NilClass #147

Closed ajbogh closed 7 years ago

ajbogh commented 8 years ago

I'm getting the following error on a rather old version of the gem in an old version of rails (unable to upgrade at the moment). I was hoping someone knew how to fix this.

Templates are under /app/assets/javascripts/templates/subfolder/file.html.slim.

application.js

//= require angular-rails-templates
//= require_tree .

angular-rails-templates 0.2.0 Rails 3.2.22.2 sprockets 2.2.3

rake assets:precompile --trace

** Execute assets:precompile:primary
rake aborted!
NoMethodError: undefined method `bytesize' for nil:NilClass
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-1.4.7/lib/rack/utils.rb:300:in `bytesize'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:13:in `initialize'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:249:in `new'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:249:in `block in build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:270:in `circular_call_protection'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:248:in `build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:93:in `block in build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:92:in `build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:169:in `find_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:60:in `find_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:105:in `each'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:249:in `new'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:249:in `block in build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:270:in `circular_call_protection'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:248:in `build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:93:in `block in build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:92:in `build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:169:in `find_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:60:in `find_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:105:in `each'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:249:in `new'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:249:in `block in build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:270:in `circular_call_protection'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:248:in `build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:93:in `block in build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:92:in `build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:169:in `find_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:60:in `find_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:105:in `each'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/processed_asset.rb:16:in `initialize'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:249:in `new'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:249:in `block in build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:270:in `circular_call_protection'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:248:in `build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:93:in `block in build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:92:in `build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:169:in `find_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:60:in `find_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/bundled_asset.rb:16:in `initialize'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:252:in `new'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:252:in `build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:93:in `block in build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/caching.rb:19:in `cache_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:92:in `build_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:169:in `find_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/index.rb:60:in `find_asset'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.2.22.2/lib/sprockets/static_compiler.rb:19:in `block in compile'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:219:in `block in each_logical_path'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:196:in `each'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:196:in `each_entry'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:204:in `block in each_file'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:203:in `each'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:203:in `each_file'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-2.2.3/lib/sprockets/base.rb:217:in `each_logical_path'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.2.22.2/lib/sprockets/static_compiler.rb:18:in `compile'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.2.22.2/lib/sprockets/assets.rake:56:in `internal_precompile'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.2.22.2/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `block in execute'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `each'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `execute'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:173:in `invoke'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.2.22.2/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `block in execute'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `each'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `execute'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:173:in `invoke'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:150:in `invoke_task'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `each'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block in top_level'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:115:in `run_with_threads'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:100:in `top_level'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:78:in `block in run'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
/Users/abogh/.rbenv/versions/2.3.1/bin/rake:22:in `load'
/Users/abogh/.rbenv/versions/2.3.1/bin/rake:22:in `<main>'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/Users/abogh/.rbenv/versions/2.3.1/bin/rub...]
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/file_utils.rb:66:in `block in create_shell_runner'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/file_utils.rb:57:in `sh'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/file_utils_ext.rb:37:in `sh'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/file_utils.rb:89:in `ruby'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/file_utils_ext.rb:37:in `ruby'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.2.22.2/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.2.22.2/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.2.22.2/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `block in execute'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `each'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `execute'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:173:in `invoke'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:150:in `invoke_task'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `each'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block in top_level'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:115:in `run_with_threads'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:100:in `top_level'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:78:in `block in run'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
/Users/abogh/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
/Users/abogh/.rbenv/versions/2.3.1/bin/rake:22:in `load'
/Users/abogh/.rbenv/versions/2.3.1/bin/rake:22:in `<main>'
/Users/abogh/.rbenv/versions/2.3.1/bin/ruby_executable_hooks:15:in `eval'
/Users/abogh/.rbenv/versions/2.3.1/bin/ruby_executable_hooks:15:in `<main>'
ajbogh commented 8 years ago

While trying to find the cause, this error happens by adding gem 'angular-rails-templates' to the Gemfile. After a bundle install I run rake assets:precompile --trace and get the error above. I went step-by-step from a working version and installed angular-rails-templates before attempting to change any code.

pjungwir commented 7 years ago

A message for people traveling to the future: if one of your angular Javascript files has some silly syntax error, it will fail to build, and then sprockets will raise this error because the file is missing.

ajbogh commented 7 years ago

I'm closing this since @pjungwir offered an explanation, and also since I'm, gladly, not longer working with Rails.