0

I have an ExecJS::RuntimeError on my Rails 4 app. I'm on Windows 7 64bit. I have already checked these two answers :

ExecJS::RuntimeError in Rails 3

and ExecJS::RuntimeError on Windows trying to follow rubytutorial

Then, I tried :

Install node.js, restard my computer, but still doesn't work !!

OR

Modify C:\RailsInstaller\Ruby2.0.0\lib\ruby\gems\2.0.0\gems\execjs-2.0.2\lib\execjs\runtimes.rb by changing.

 JScript = ExternalRuntime.new(
          :name        => "JScript",
          :command     => "cscript //E:jscript //Nologo",
          :runner_path => ExecJS.root + "/support/jscript_runner.js",
          :encoding    => 'UTF-8' # CScript with //U returns UTF-16LE
        )

by

JScript = ExternalRuntime.new(
      :name        => "JScript",
      :command     => "cscript //E:jscript //Nologo",
      :runner_path => ExecJS.root + "/support/jscript_runner.js",
      :encoding    => 'UTF-8' # CScript with //U returns UTF-16LE
    )

But it does not work neither !

I know that remove the line //= require_tree . of application.js works but I don't want a bad fix.

What should I do ?

I precise that ALL my js files (except application.js) are empty.

My gemfile :

 ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '4.0.2'
gem 'bootstrap-sass', '~> 3.0.3.0'
gem 'bcrypt-ruby', '3.1.2'

group :development, :test do
  gem 'sqlite3', '1.3.8'
  gem 'rspec-rails', '2.13.1'
  #advanced stuff
  gem 'guard-rspec', '2.5.0'
  gem 'spork-rails', '4.0.0'
  gem 'guard-spork', '1.5.0'
  gem 'childprocess', '0.4.0'
end

group :test do
  gem 'selenium-webdriver', '2.35.1'
  gem 'capybara', '2.1.0'
  gem 'rb-notifu', '0.0.4'
  gem 'factory_girl_rails', '4.2.1'
end

gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
gem 'execjs'

group :doc do
  gem 'sdoc', '0.3.20', require: false
end

group :production do
  gem 'pg', '0.15.1'
  gem 'rails_12factor', '0.0.2'
end
Community
  • 1
  • 1
Léo
  • 792
  • 1
  • 7
  • 27

7 Answers7

1

Based on this link: https://stackoverflow.com/questions/12520456/execjsruntimeerror-on-windows-trying-to-follow-rubytutorial I think you should try to see which .js file generates the error.

That line is compiling every .js.coffee file in app/assets/javascripts into JavaScript and then adding it to your layout (but only in development mode; in production mode, the compiled js is added to your application.js file). Having require_tree . shouldn't be causing errors, so somehow you've got an issue with one of the files that's being included. Can you post a list of all the files in your app/assets/javascripts directory? Also, you can try completely deleting the contents of sessions.js.coffee and adding back //= require_tree . and see if the error still exists.

Vadorequest
  • 16,593
  • 24
  • 118
  • 215
0

try this out:-

   add gem therubyracer to your gemfile and then do bundle install
Sachin Singh
  • 7,107
  • 6
  • 40
  • 80
0

Window already has ExecRuntime engine installed and it does not need anything to done. It should automatically pickup best runtime available. You does not even need to install nodejs.

Sanjiv
  • 813
  • 6
  • 13
0

I would not spend the effort trying to patch for Windows. I recommend installing 'therubyracer' gem [V8 embedded] or node.js. If the issue persists; please provide a copy of your Gemfile.lock so we can verify your bundle install.

dans3itz
  • 1,605
  • 14
  • 12
  • I already installed therubyracer gem by using https://github.com/hiranpeiris/therubyracer_for_windows – Léo Feb 08 '14 at 21:23
0

Change the ExecJS version to 1.2.4

  1. Go to the Gemfile
  2. Type gem 'execjs', '1.2.4'
  3. Go to the command line in the application: bundle install
  4. Prosper
belozi
  • 1
  • 1
0

Please never develop Rails project in special folder such as Google Drive Syns. This might help you. The full detail is here: http://www.angkorbrick.com/rails-should-not-put-project-repository-in-google-drive-syns-folder/

Kuroun
  • 87
  • 1
  • 8
-1

I "resolved" the problem, I formated my laptop and installed Windows 7 Ultimate...

Léo
  • 792
  • 1
  • 7
  • 27