Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Martin S
Martin S
1,724 Points

/statuses/

Hi, in "getting started with rails" lesson: "generate a new rails application" I can't seem to get this new "statuses" page to work. When I go to: http://127.0.0.1:3000/statuses/

the response I get is:

ExecJS::RuntimeError in Statuses#index

Showing C:/Sites/treebook/app/views/layouts/application.html.erb where line #6 raised:

(in C:/Sites/treebook/app/assets/javascripts/statuses.js.coffee) Extracted source (around line #6):

3: <head> 4: <title>Treebook</title> 5: <%= stylesheet_link_tag "application", :media => "all" %> 6: <%= javascript_include_tag "application" %> 7: <%= csrf_meta_tags %> 8: </head> 9: <body> Rails.root: C:/Sites/treebook

Application Trace | Framework Trace | Full Trace app/views/layouts/application.html.erb:6:in _app_views_layouts_application_html_erb___743382351_23893476' app/controllers/statuses_controller.rb:7:inindex' Request

Parameters:

None Show session dump

Show env dump

Response

Headers:

None

11 Answers

Nick Pettit
STAFF
Nick Pettit
Treehouse Teacher

Hey Martin,

I'm not sure what's going on here, but I'll notify Jim and Jason so they can take a look and get back to you. :)

Jim Hoskins
STAFF
Jim Hoskins
Treehouse Guest Teacher

Did you run bundle install? If so check your Gemfile and make sure the line "gem therubyracer" is not commented. Meaning make sure the line doesn't start with #. Save and run bundle install.

That should do it. It can't find a JavaScript runtime on your computer and therubyracer will get you set up

Jody Albritton
PLUS
Jody Albritton
Courses Plus Student 5,497 Points

On windows you do not need "The Ruby Racer", it should remain commented out Jim. Ruby racer does not have a windows binary and will not work. Windows has its own JS runtime.

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

I've seen this a couple of times. Here's a possible fix:

Download and install nodejs from http://nodejs.org/download/.

Add the following to the Gemfile:

gem "execjs"

Then run "bundle install" and try it again.

Michelle Hurwitz
Michelle Hurwitz
11,854 Points

yes, this worked for me! Thanks Jason, didn't even need to add to the Gemfile, just ran command prompt through node.js . Thanks!

Did anyone find a fix for this? im having the same issue. Does the gem file solution work?

I tried Jasons' solution and it works. Thanks!

Martin S
Martin S
1,724 Points

THanks for all the tips, I'm afraid I'm a newbie so I'm not sure if I did that correctly:

1 - Installed node.js

2 - went to treebook folder and edited 'gemfile' in sublime to add: gem "execjs" to line 40 (at the end)

3 - saved the folder

4 - opened 'command prompt with ruby and rails' cd to treebook\ directory

5 - 'bundle install'

6 - 'rails server'

after this I still had the same issue... I get the welcome page @ http://127.0.0.1:3000/

but still receive those errors @ http://127.0.0.1:3000/statuses/

I'll tr

Martin S
Martin S
1,724 Points

I'll try restarting and see how it goes, please let me know if you can see where I'm going wrong! Here is the text from my gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.1'

Bundle edge Rails instead:

gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

Gems used only for assets and not required

in production environments by default.

group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer'

gem 'uglifier', '>= 1.0.3' end

gem 'jquery-rails'

To use ActiveModel has_secure_password

gem 'bcrypt-ruby', '~> 3.0.0'

To use Jbuilder templates for JSON

gem 'jbuilder'

Use unicorn as the web server

gem 'unicorn'

Deploy with Capistrano

gem 'capistrano'

To use debugger

gem 'ruby-debug19', :require => 'ruby-debug'

gem "execjs"

Heres what I did to fix mine:

Installed the nodejs exe file ( I skipped the gems part ) then ran the rails installation again. (railsinstaller.exe)

Martin S
Martin S
1,724 Points

@Kerde, thanks, re-installing rails after installing node.js seems to have done the trick!

I installed node.js and re-installed rails, and I'm still getting this problem.