EOF error javascript_include_tag Rails 4

I'm getting an error I can't seem to figure out the cause of:

EOF Error end of file reached 

called from /app/views/layouts/application.html.erb, line 6:

<%= javascript_include_tag "application", "data-turbolinks-track" => true %>

In ruby, an EOF error is a subclass of IOError, and is raised by an IO operation reaching the end of a file.

Here's some of what I've found out so far:

Using:

<%= javascript_include_tag :defaults, "data-turbolinks-track" => true %>

...or...

<%= javascript_include_tag :all, "data-turbolinks-track" => true %>

or even listing out the individual js files via javascript_include_tag work to remove the EOF error.

I thought this might be caused by some sprockets directives, so I deleted all the directives in application.js. This did not change anything.

Running rake assets:precompile also gives me:

rake aborted!
end of file reached 

Running git diff on the app/assets/javascripts directory shows 1 thing that may be of note in a .js file I had been editing recently:

+$(document).on('ready page:load', function() {
+
+     // some code I had written
+
+});
\ No newline at end of file

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.

EDIT: Pointing my browser to localhost:3000/assets/application.js gives me this:

throw Error("EOFError: end of file reached")

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:

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 `<main>'

Answers


Try deleting your local project directory and checking out a fresh copy.

I experienced an aborted rails server startup today that perhaps left my system in an inconsistent state and resulted in the same exact error you were experiencing. A ruby 2.0.0-p0 segfault stopped my rails server startup, after which I could not load any pages due to the aforementioned error.

I do not know for sure what caused this original failure, unfortunately. Fortunately, I don't have to deal with it anymore on my end!


If you still have your old repo lying around, then you can run bundle exec rake tmp:clear. I reckon that'll fix it.


Cleaning up the temp files using the following command fixes this issue:

rake tmp:clear

If you're having this problem on Windows, try going into your Gemfile.lock file and manually changing the value of coffee-script-source to 1.8.0 (mine started as 1.9.1.1). Something about newer versions doesn't play nice for whatever reason.


Need Your Help

iOS - How to sign SOAP message with x509 certificate

iphone security soap certificate ws-security

I'm working on iPhone client using SOAP message with x509 certificate.

jboss-as-maven-plugin deploy location

jboss7.x maven-plugin

I deployed an ejb jar through jboss-as-maven-plugin in JBoss AS 7.1. The jar is deployed properly but I can't seem to find the location of jar in the server. I checked the standalone/deployments fo...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.