3

I'm new to ruby and rails and walking (crawling?) through the tutorial. the second project uses scaffolding to create a user that consists of a name and email address. when i try to view the users screen I get the following:

ExecJS::RuntimeError in Users#index

Showing /home/max/rails_proj/demo_app/app/views/layouts/application.html.erb where line #6 raised:

湉異⁴牅潲㩲唠歮潮湷漠瑰潩⼢浴⽰硥捥獪〲ㄱ㤰㔲㐭㜲ⴲ㠱㝮穩ⴰ⸰獪•灳捥晩敩⹤਍
  (in /home/max/rails_proj/demo_app/app/assets/javascripts/users.js.coffee)
Extracted source (around line #6):

3: <head>
4:   <title>DemoApp</title>
5:   <%= stylesheet_link_tag    "application" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8: </head>
9: <body>
Rails.root: /home/max/rails_proj/demo_app

Application Trace | Framework Trace | Full Trace
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__1031573605_1065816420'
app/controllers/users_controller.rb:7:in `index'

I am using windows xp, cygwin, rails 3.1.0 (i've tried the new rc1 also), ruby 1.8.7.

I found this error on google and there's supposedly a fix which i've tried to use (the execjs gem 1.2.9) but that doesn't seem to fix it for me.... i have tried all the fixes (to the best of my limited ruby etc ability at this point) but nothing seems to work although the error message is sometimes different - still errors on the same line.

I've tried to uninstall and reinstall cygwin, ruby, rails etc.. to no avail so far...

any feedback would be great!

1

7 Answers 7

5

I got the same error on cygwin. I tried compiling the latest node.js (v0.6.15) but it said cygwin was not supported. Older version seem to support it so here's what I did:

wget http://nodejs.org/dist/node-v0.4.12.tar.gz
tar xvfz node-v0.4.12.tar.gz
cd node-v0.4.12/
./configure
make
make install

I'm not sure if there is a newer version than 0.4.12 that will work under cygwin, but this seems to fix my problem for now. Also I seemed to have the proper prereq's but if you have trouble during configure or make then just do a search on "step by step install nodejs cygwin".

Sign up to request clarification or add additional context in comments.

2 Comments

That seems to be working! The Windows version of NodeJS fails with ExecJS.
It's possible to build latest Node using MinGW+MSYS, and presumably Cygwin too with a little modification, see this blog post. I don't know if that would also solve this issue.
3

I am not sure if this will work in your case, but on Ubuntu you can add

gem 'therubyracer'

to your Gemfile and it will work just fine.

Another tip would be to comment out the following lines in the Gemfile:

group :assets do
#  gem 'sass-rails', "  ~> 3.1.0"
#  gem 'coffee-rails', "~> 3.1.0"
#  gem 'uglifier'
end

since those are the ones that require execjs

4 Comments

therubyracer requires libv8, which won't install on Windows or Cygwin.
that's why I state in my answer that it will work on Ubuntu - so thanks for the unjustified downvote!!
The question was about Windows.
I'm in the same position as the original poster. As @Chloe says I cannot install libv8, so your first solution does not work. I attempted your second solution and it still produces an error: "LoadError in Users#index" "cannot load such file -- coffee_script"
1

I also had this problem, and it was solved installing a javascript runtime:

sudo apt-get install nodejs

I follow this post:

http://www.adanacs.com/node/3

Good luck!

1 Comment

apt-get is not a Cygwin package installer.
0

As someone who tried to do that book on windows, I have 2 pieces of advice:

  1. Install Ubuntu to run ruby on rails. It is a little bit of work, but if you are going to invest time and effort it is worth it 100 times over. You can set up dual install with existing windows. Or, just find an old computer and install it on there. It uses much less power than windows xp and only about 300 Mb of memory.

  2. Start with Agile Web Development with Rails. http://www.amazon.com/Agile-Development-Rails-Pragmatic-Programmers/dp/1934356549 . It is a much better first tutorial.

1 Comment

didn't do # 2 but #1 got me there until i got the boss to buy me a mac :)
0

I had a similar problem. Helped me to update Ruby 1.9.3 on Ruby 2.0.0.

Comments

-1

Run

bundle install

in cmd and it will install some new gems.

Go back to cygwin and launch your server

rails s

and all will be well. I had the same problem. Cygwin seems to be the issue here.

Comments

-1

On windows, I had the same problem. It seems there is no javascript interpreter installed to compile the coffeescript that is used in scaffolds. Install node.js from http://nodejs.org/ and restart the command prompt you were using to run rails, in order to update the path.

I don't have cygwin installed, so I couldn't compile node.

4 Comments

The Windows version of NodeJS gives this error when using ExecJS: Error: Cannot find module 'C:\tmp\execjs20130226-3968-bapw1p.js'
@Chloe, Here is an issue on ExecJS github which looks like what you have written, it may help: github.com/sstephenson/execjs/issues/48 . I only posted what worked for me, not sure what the downvote is for.
Here is the solution: stackoverflow.com/a/10114528/148844. The question was for Cygwin.
ok, thanks for that info, I missed the Cygwin association. I think you'll find that MingW Rails (via RubyInstaller) is better supported than Cygwin these days.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.