I am facing a problem when i fetched the rails project from github.
When i cloned the repository and try to run the code from a remote system, i got the following errors.
["ok","(function() {\n\n\n\n}).call(this);\n"]
(in e:/github_projects/myfork/TestRepo/TestProj/app/assets/javascripts/users.js.coffee)
Extracted source (around line #6):
3: <head>
4: <title>TestProj</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
9: <body>
I am currently using rails 3.2.0 in windows environment.
I have created only a simple rails project with user scaffold in order to test it.
Its working fine while i worked with that in my local system before moving to github.
Thanks,
Mani
It's quite strange, I might recommend that you delete everything in the user.js.coffee and save it and try again. It looks that there's some wrong returns in there.
Related
Firstly I'm still busy learning RoR so my understanding is limited. I created a new simple project and generated my first scaffold named 'Person'. When I start up my WEBrick server I go to localhost:3000/people I get the following runtime error:
ExecJS::RuntimeError in People#index
Showing C:/Users/Dean/Desktop/guestbook/app/views/layouts/application.html.erb where line #6 raised:
(in C:/Users/Dean/Desktop/guestbook/app/assets/javascripts/people.js.coffee)
Extracted source (around line #6):
3: <head>
4: <title>Guestbook</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
9: <body>
If any more clarification is needed please let me know and I'll gladly update my question.
I'm no expert but it looks like it's something to do with.. the coffeescript gem? I'm really just spitballin' here... Thanks in advance!
people.js.coffee:
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
ExecJS::RuntimeErrors are typically caused by syntax errors in your coffeescript. Check your people.js.coffee file around line 6 and make sure it is syntactically correct. If you are relatively unfamiliar with coffeescript, http://js2coffee.org/ converts between JS and coffee and might be helpful. .js.coffee files will only accept coffeescript.
I'm at 5.1.2 of the railstutorial, I have just installed Bootstrap-sass (I've double checked, the gem is there). http://ruby.railstutorial.org/chapters/filling-in-the-layout#top
I added this file:
app/assets/stylesheets/custom.css.scss
And when I give it this content:
#import "bootstrap";
My http://localhost:3000/static_pages/home does not work anymore. It gives the following error:
ArgumentError in Static_pages#home
Showing c:/Sites/rails_projects/sample_app/app/views/layouts/application.html.erb where line #5 raised:
different prefix: "e:/" and "c:/Sites/rails_projects/sample_app/app/assets/stylesheets"
(in c:/Sites/rails_projects/sample_app/app/assets/stylesheets/custom.css.scss)
Extracted source (around line #5):
2: <html>
3: <head>
4: <title><%= full_title(yield(:title)) %></title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: <!--[if lt IE 9]>
Rails.root: c:/Sites/rails_projects/sample_app
Application Trace | Framework Trace | Full Trace
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___557356520_29974776'
Any help would be much appreciated, thanks!
Your gems is in E: while your app is in C:\
When trying to #import, Assets module will search several places including gem path. But it can't recognize the disk within the path. That's why your #import fails.
Suggestion: Put your app and gems in same disk.
Side note: Don't use Windows for Rails development at all.
I just installed passenger and I believe I got it working, but now my rails application seems to be unable to load cached assets. When attempting to load a page I get this message:
ActionView::Template::Error (No such file or directory - /home/glawson/vidStream/tmp/cache/assets/sprockets%2Ff1663d34d4b6003379113df98f1433a520130421-27670-18ux0pw.lock):
2: <html>
3: <head>
4: <title>VidStream</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8:
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___4187138815701226714_20468720'
This happens when I try to run my webapp with passenger or in development with rails server. I'm a little fuzzy on what the error even means other than it can't find a file that it's looking for.
In production mode you need to precompile the asset directory using
RAILS_ENV=production rake assets:precompile
Then only it will work. Because by default for prod asset precompile is enabled.
I successfully deployed my rails app to my VPS, but when I try to look at my server from browser, I get a 500 error ("We're sorry, but something's wrong"). The app is working fine locally, so I think the problem lies in not my code but somewhere else.
Here's the log from /current/log/production.log
ActionView::Template::Error (jquery.js isn't precompiled):
4: <title>Songhomme</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= javascript_include_tag 'jquery' %>
8: <%= csrf_meta_tags %>
9: </head>
10: <body>
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb___2525571063257357898_28769560'
I also got the following error:
ActionView::Template::Error (/home/deployer/apps/songhomme/releases/20121204091428/app/views/posts/_posts.erb:27: syntax error, unexpected ',', expecting ')'
...ppend= ( link_to (t.name + " ", '/tags/' + t.id.to_s) );#out...
The code is working fine locally, so I'm not sure what's wrong with the second part of code. For the first part of code, does running rake assets:precompile before I push to my repo solve the problem?
I appreciate your help.
Try declaring your js includes in the manifest file application.js , not by javascript_include_tag. Since Rails version 3 this is the proper way . So , in your application.js :
//= require jquery
//= require jquery_ujs
I've tried numerous fixes and variations of those fixes that I've found online but none work. My problem is that I have a custom stylesheet that is called if the browser is IE (stylesheet-ie.css.scss). I've ran the following with no success:
rake assets:precompile
I get the following error in production.log after running compile command.
ActionView::Template::Error (stylesheet-ie.css isn't precompiled):
14: <title><%= full_title(yield(:title)) %></title>
15: <%= stylesheet_link_tag "application", media: "all" %>
16: <!--[if IE]>
17: <%= stylesheet_link_tag("stylesheet-ie") %>
18: <![endif]-->
19: <%= javascript_include_tag "application" %>
20: <%= csrf_meta_tags %>
In production.rb I have:
config.assets.precompile += ['stylesheet-ie.css']
The file is assets/stylesheet/stylesheet-ie.css.scss...I had it as stylesheet.css before but changed it trying to get it to work. Neither way works.
At this point I don't know what else to do.
Does this work in development environment?
While doing a precompile, you will have to specify the environment. Are you doing this anywhere?
RAILS_ENV=production rake assets:precompile
This should compile your assets in case you are not mentioning your environment elsewhere.
Hrm.
I have my config/application.rb set up like this:
config.sass.load_paths << File.expand_path('../../lib/assets/stylesheets/')
config.assets.precompile += %w(jquery.animate-colors-min.js ie.js ie8.css)
So it's pretty similar, but you didn't mention the load_paths. (Also, BTW, I'm using .css.sass, so I'm not sure if you'll need to fiddle with config.sass or config.scss.)
—☈