title: EOF error javascript_include_tag Rails 4
body: <p>I'm getting an error I can't seem to figure out the cause of:</p>
  
  <pre><code>EOF Error end of file reached 
  </code></pre>
  
  <p>called from /app/views/layouts/application.html.erb, line 6:</p>
  
  <pre><code>&lt;%= javascript_include_tag "application", "data-turbolinks-track" =&gt; true %&gt;
  </code></pre>
  
  <p>In ruby, an EOF error is a subclass of IOError, and is raised by an IO operation reaching the end of a file. </p>
  
  <p>Here's some of what I've found out so far:</p>
  
  <p>Using: </p>
  
  <pre><code>&lt;%= javascript_include_tag :defaults, "data-turbolinks-track" =&gt; true %&gt;
  </code></pre>
  
  <p>...or... </p>
  
  <pre><code>&lt;%= javascript_include_tag :all, "data-turbolinks-track" =&gt; true %&gt;
  </code></pre>
  
  <p>or even listing out the individual js files via javascript_include_tag work to remove the EOF error.</p>
  
  <p>I thought this might be caused by some sprockets directives, so I deleted all the directives in application.js. This did not change anything.</p>
  
  <p>Running rake assets:precompile also gives me:</p>
  
  <pre><code>rake aborted!
  end of file reached 
  </code></pre>
  
  <p>Running <code>git diff</code> on the app/assets/javascripts directory shows 1 thing that may be of note in a .js file I had been editing recently: </p>
  
  <pre><code>+$(document).on('ready page:load', function() {
  +
  +     // some code I had written
  +
  +});
  \ No newline at end of file
  </code></pre>
  
  <p>That "no newline at end of file" bit... I have never seen that before. However, I just inserted a newline at the end of the same file and committed the change, and that comment is now gone from the diff.</p>
  
  <p>EDIT:
  Pointing my browser to localhost:3000/assets/application.js gives me this:</p>
  
  <pre><code>throw Error("EOFError: end of file reached")
  </code></pre>
  
  <p>I am thoroughly stumped and have been trying to debug this for the entire day. Why is this error occurring? Here is the stacktrace from when I run rake assets:precompile:</p>
  
  <pre><code>rake aborted!
  end of file reached
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0.rc2/lib/active_support/core_ext/marshal.rb:6:in `load'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0.rc2/lib/active_support/core_ext/marshal.rb:6:in `load_with_autoloading'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/cache/file_store.rb:19:in `block in []'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/cache/file_store.rb:19:in `open'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/cache/file_store.rb:19:in `open'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/cache/file_store.rb:19:in `[]'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/caching.rb:14:in `cache_get'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/caching.rb:84:in `cache_get_hash'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/caching.rb:54:in `cache_asset'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/bundled_asset.rb:37:in `init_with'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/asset.rb:24:in `from_hash'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/caching.rb:54:in `cache_asset'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:257:in `benchmark'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:210:in `find_asset'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:119:in `block in compile'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `each'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `compile'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.10.0/lib/rake/sprocketstask.rb:146:in `with_logger'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
  /Users/kevinyoung/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `&lt;main&gt;'
  </code></pre>