简体   繁体   中英

Rails Asset javascript Template Errors

Went to bed last night with a full functioning app. I was fed up with webrick's performance and determined to use a different web server for development. I woke up and installed Thin. I instantly received errors. I couldn't figure out what was going on so I uninstalled Thin and went back to Webrick to get some things done. To my surprise the errors were still there!

Here's the error:

Started GET "/signin" for 127.0.0.1 at 2012-04-28 11:01:28 -0700
Processing by SessionsController#new as HTML
Rendered sessions/new.html.erb within layouts/application (2.0ms)
Compiled application.js  (287ms)  (pid 2928)
Completed 500 Internal Server Error in 868ms

ActionView::Template::Error (cannot load such file -- ["ok","(function() {\n\n\n\n}).call(this);\n"]

(in E:/[my app's directory]/app/assets/javascripts/admins.js.coffee)):
13:   <meta name="viewport" content="width=1024, maximum-scale=1.0">
14:   <%= stylesheet_link_tag "application", :debug => Rails.env.development? %>
15:   <%= yield :headercss %>
16:   <%= javascript_include_tag "application", :debug => Rails.env.development? %>
17:   <%= yield :headerjs %>
18:   <%= csrf_meta_tags %>
19: </head>

app/views/layouts/application.html.erb:16:in `_app_views_layouts_application_html_erb__960238137_43581456'
config/initializers/quiet_assets.rb:5:in `call_with_quiet_assets'

Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (7.0ms)

I tried precompiling...I got the same issue. It's puking on my javascript_include_tag...this is driving me crazy. It's looking for the admins.js.coffee file...If I remove it, it will throw an error on the next javascript file in line. I'm totally confused, please help! Somebody help! :D

Wow. I just wasted 5 hours of my life. After going crazy with troubleshooting craziness...in desperation, I started doing weird things....I eventually cut and pasted all my .coffee files out of my assets/javascripts folder and pasted them back and everything worked!!!! and yes I cleared my tmp cache, asset cache and every cache I could think of cache...wtf!!!!

Thank you for asking this question and agmcleod for pointing to right direction... Have started getting this error after trying to upgrade to 3.2, and was trying to figure out the guilty js part for the last few days :)

execjs and coffee-script-source has been upgraded recently but not coffee-script

coffee-rails (3.1.1)
  coffee-script (>= 2.2.0)
  railties (~> 3.1.0)
coffee-script (2.2.0)
  coffee-script-source
  execjs
**coffee-script-source (1.2.0)**
**execjs (1.3.0**)
  multi_json (~> 1.0)

Including these exact versions in gemfile resolved the issue for me, hope it helps you as well.

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM