Search code examples
javascriptruby-on-railsasset-pipelinerubber

application.js file showing up as application.html.erb when sent to client


After running a cap deploy, I'm getting an error when navigating to my site on the client:

Uncaught SyntaxError: Unexpected token '<' application-[hash here].js line 1

When I look at the file "application.js" on the client, it simply shows me a rendered version of my application.html.erb. The first line of that file is naturally <!DOCTYPE html> so it makes sense that it would get that error at line 1. But why would html be getting sent over in place of my javascript? I ran this same deploy several times earlier today and it worked fine.

I understand there are all sorts of variables here that could be causing this issue, but I guess what I'm looking for are just thoughts on what could possibly be causing the issue.

Any thoughts?


Solution

  • If anyone who happens to run into this error in the future, it turned out that the issue I was having was actually with my nginx.conf file. Had nothing to do with rails.