Jatin Jatin - 1 year ago 95
Ruby Question

Hartl rails tutorial chapter 5 error

I have been trying to work out the basic layout of the site but the following error shows up every time i run the application on local server.

ExecJS::ProgramError in StaticPages#home
Showing E:/workspace/sample_app/app/views/static_pages/home.html.erb where line #13 raised:

TypeError: Object doesn't support this property or method

<%= link_to image_tag("rails.png", alt: "Rails logo"),
'http://rubyonrails.org/' %>

Here is the code for the file home.html.erb

<div class="center jumbotron">
<h1>Welcome to the Sample App</h1>

This is the home page for the
<a href="http://www.railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.

<%= link_to "Sign up now!", '#', class: "btn btn-lg btn-primary" %>

<%= link_to image_tag("rails.png", alt: "Rails logo"),
'http://rubyonrails.org/' %>

Answer Source

Based on our comments, your issue is with windows running rails. There are a number of issues, particularly with the way javascript/coffeescript work in rails that causes this error to pop up in windows. It's very difficult to troubleshoot all these issues, and I have not found a good resource that walks you through it. I have found online and met real life programmers who attempted to run rails on windows for 4 hours or a day before understanding the hurdles and switching operating systems. You can attempt to figure out how to get windows to work, but you'll spend a bit of time (maybe 40 solid hours, but I have no idea how deep the issues go) fighting against the OS, when you should be coding.

You should switch to a linux or mac operating system. I use linux ubuntu. You can still use the same computer and run a virtual machine - that's running windows, and running linux or mac on top of it - if you have a pretty good computer. There are plenty of resources and tutorials on virtual machines available through google searches.

Alternatively, you can run dual operating systems and get both linux and windows working on the same pc. When you start your computer up, it gives you an option to load one or the other. Or just drop your operating system and run linux. That's the easiest option. Very little troubleshooting and you get right into it.

I found/guessed your error by looking at this information.

where line #13 raised:

TypeError: Object doesn't support this property or method         

At first I thought you had a typo, which is why I asked you to post your code, but there didn't one there. After googling 'TypeError: Object doesn't support this property or method' I was seeing a lot of hits citing windows errors. In the future try googling your error first to save yourself some time and get a better understanding of coding.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download