small medium large xlarge

Generic-user-small
19 Sep 2011, 22:37
Jino Thomas (2 posts)

I am receiving an error when running Depot for the first time at localhost:3000/products (page 67)

NOTE: the demo app works fine. I am running the updated 3.1 version from RailsInstaller version 2.0 on Windows 7

Screen capture of the error


ExecJS::RuntimeError in Products#index

Showing D:/Zector/rails/work/depot/app/views/layouts/application.html.erb where line #6 raised:

䌧尺坜湩潤獷屜祓瑳浥㈳屜獣牣灩⹴硥履‧獩渠瑯爠捥杯楮敺⁤獡愠湩整湲污漠⁲硥整湲污挠浯慭摮ബ漊数慲汢⁥牰杯慲牯戠瑡档映汩⹥਍
  (in D:/Zector/rails/work/depot/app/assets/javascripts/products.js.coffee)

Extracted source (around line #6):

3: 
4:   Depot
5:   <%= stylesheet_link_tag    "application" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8: 
9: 

Rails.root: D:/Zector/rails/work/depot

Application Trace | Framework Trace | Full Trace

app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___554235847_35047824'
app/controllers/products_controller.rb:7:in `index'


Request

Parameters: 
Generic-user-small
20 Sep 2011, 10:51
Harsh Pandit (1 post)

1) Go to your application cd Products 2) Then Edit your gemfile edit gemfile 3) In Editor window write following line in file gem ‘execjs’, :git => ‘git://github.com/kennyj/execjs.git’ 4) Save File and install bundle again bundle install

like below C:\Sites\TESTAP~1>bundle install Fetching git://github.com/kennyj/execjs.git remote: Counting objects: 854, done. remote: Compressing objects: 100% (441/441), done. remote: Total 854 (delta 457), reused 793 (delta 398)Receiving objects:

Receiving objects: 100% (854/854), 94.14 KiB | 42 KiB/s, done. Resolving deltas: 100% (457/457), done. Fetching source index for http://rubygems.org/ ……..

5)now restart your server and check again.

Samr_small_pragsmall
20 Sep 2011, 11:44
Sam Ruby (634 posts)

If I’m following the commit logs correctly, it looks like a simple bundle update will do… as it will install execjs (1.2.7) which contains this fix:

https://gist.github.com/rails/rails/issues/2880#issuecomment-2125197 https://github.com/sstephenson/execjs/pull/46 https://github.com/sstephenson/execjs/commits/master

Me_pragsmall
20 Sep 2011, 14:01
Emile Silvis (1 post)

Hi Sam - a @bundle update@ does not seem to fix it. A GitHub issue was logged: https://github.com/sstephenson/execjs/issues/48

Generic-user-small
20 Sep 2011, 20:10
Jay Downey (1 post)

I get the same error when trying to run the example in Chapter 2 “Instant Gratification.” Instead of getting the display in Figure 2.2, I get the following in both IE8 and Firefox 4. I am definitely a noob so I apologize if I’ve missed something that might be completely obvious to most of the users here.

bq. ExecJS::RuntimeError in Say#hello

Showing C:/Ruby/WORK/demo/app/views/layouts/application.html.erb where line #6 raised:

䌧尺坜义佄南屜祳瑳浥㈳屜獣牣灩⹴硥履‧獩渠瑯爠捥杯楮敺⁤獡愠湩整湲污漠⁲硥整湲污挠浯慭摮ബ漊数慲汢⁥牰杯慲牯戠瑡档映汩⹥਍ (in C:/Ruby/WORK/demo/app/assets/javascripts/say.js.coffee)

Extracted source (around line #6):

3: <head> 4: Demo 5: <%= stylesheet_link_tag “application” %> 6: <%= javascript_include_tag “application” %> 7: <%= csrf_meta_tags %> 8: </head> 9: <body>

Rails.root: C:/Ruby/WORK/demo Application Trace | Framework Trace | Full Trace

app/views/layouts/application.html.erb:6:in `app_views_layouts_application_html_erb__599409497_16714068’

Request

Parameters:

None

Show session dump

Show env dump Response

Headers:

None

Generic-user-small
20 Sep 2011, 19:13
Jino Thomas (2 posts)

Thanks Harsh Pandit. That worked! NOTE: if using copy/paste replace the single quotes. They showed up as different.

I am new to RoR so could you explain the fix. I assume it simply replaced the gem bundle ‘execjs’ with your source rather then my installed version? Would an update fix this? Please explain as I am eager to learn.

Thanks again.

Samr_small_pragsmall
20 Sep 2011, 22:41
Sam Ruby (634 posts)

Once again, I will suggest bundle update as execjs 3.1.8 contains the following fix:

https://github.com/sstephenson/execjs/commit/a7cdbfc0c1c89b6b2570f74673b4aceffe7c9d56

If you have changed your Gemfile, please undo that change and test this fix.

Generic-user-small
12 Oct 2011, 00:50
Sean Robbins (2 posts)

I had the same error on Ubuntu.

At the moment the only way I can get this to work is to completely remove execjs. Following the instructions here: http://stackoverflow.com/questions/5955004/ruby-on-rails-3-1-without-execjs

This might cause me some pain as I work through the rest of the book?

Samr_small_pragsmall
12 Oct 2011, 11:11
Sam Ruby (634 posts)

If you commented out sass and coffeesript, you will likely not be able to follow along with the 3.1 version of the book.

Ubuntu is my primary development environment, and I haven’t seen this problem. I run with both 10.04 and 11.04. This particular problem was pretty Windows specific.

What you want to do is to get to the point where rake about returns an indication that it has found a JavaScript Runtime. Typically, the easiest way to accomplish this is to simply apt-get install nodejs.

Generic-user-small
12 Oct 2011, 20:12
Sean Robbins (2 posts)

Yeah, my bad. I needed to install a JavaScript Runtime. I’ve installed nodejs and the error has gone.

Thanks.

Generic-user-small
31 Dec 2011, 22:59
Bradley Pattee (1 post)

I am running linux mint 12.

I got syntax errors when I tried Harsh’s edits to the gemfile. But that gave me the idea of trying it from the command line.

The following solved the problem for me:


brad@wubi ~/work/demo $ gem install execjs Successfully installed execjs-1.2.13 1 gem installed Installing ri documentation for execjs-1.2.13… Installing RDoc documentation for execjs-1.2.13… ————————-

Good Journeys, Brad

You must be logged in to comment