Problem with execjs running michael hartl windows tutorial ... ExecJS :: RuntimeError in Users # index

I am new to ruby ​​and rails and walk (walk around?) Through the tutorial. the second project uses scaffolding to create a user consisting 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 use windows xp, cygwin, rails 3.1.0 (I also tried the new rc1), ruby ​​1.8.7.

I found this error on google and there might have been a fix that I was trying to use (execjs gem 1.2.9), but that doesn't seem to fix it for me .... I tried all the fixes (for the best of mine ruby's limited features, etc.), but nothing works, although the error message is sometimes different - there are still errors on the same line.

I tried uninstalling and reinstalling cygwin, ruby, rails, etc., until it helped ...

any feedback would be great!

+3
source share
7 answers

As someone who tried to make this book on windows, I have 2 tips:

  • Install Ubuntu to run rubies on rails. It's a bit of work, but if you're going to invest time and effort, it's worth it 100 times. You can configure a dual installation with existing windows. Or just find the old computer and install it there. It uses much less power than Windows XP, and only about 300 MB of memory.

  • Get started with Agile Web Development with Rails. http://www.amazon.com/Agile-Development-Rails-Pragmatic-Programmers/dp/1934356549 . This is a much better first textbook.

0
source

I got the same error on cygwin. I tried to build the latest node.js (v0.6.15), but he said that cygwin is not supported. The old version seems to support it, here is 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 at the moment this seems to fix my problem. Also, I seemed to have the correct prereq, but if you had problems during setup or creation, just do a search for “step by step install nodejs cygwin”.

+5
source

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

 gem 'therubyracer' 

to your gemfile and it will work fine.

One more tip: 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 that require execjs

+3
source

I also had this problem and it was decided to install javascript runtime:

sudo apt-get install nodejs

I am following this post:

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

Good luck

+1
source

I had a similar problem. It helped me upgrade Ruby 1.9.3 to Ruby 2.0.0.

0
source

Run

 bundle install 

in cmd and it will install some new gems.

Go back to cygwin and start your server

 rails s 

and all will be well. I have the same problem. Cygwin seems to have a problem here.

-1
source

In windows I had the same problem. There seems to be no javascript interpreter installed to compile coffeescript that is used in scaffolding. Install node.js from http://nodejs.org/ and restart the command line that you used to run the rails to update the path.

I do not have cygwin, so I could not compile node.

-1
source

Source: https://habr.com/ru/post/981005/


All Articles