0

我的 Rails 4 应用程序上有一个 ExecJS::RuntimeError。我在 Windows 7 64 位。我已经检查了这两个答案:

Rails 3 中的 ExecJS::RuntimeError

Windows 上的 ExecJS::RuntimeError 试图遵循 ruby​​tutorial

然后,我尝试了:

安装node.js,重启电脑,还是不行!!

或者

通过更改修改 C:\RailsInstaller\Ruby2.0.0\lib\ruby\gems\2.0.0\gems\execjs-2.0.2\lib\execjs\runtimes.rb。

 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
        )

经过

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
    )

但它也不起作用!

我知道删除工作线//= require_tree .application.js但我不想要一个糟糕的修复。

我应该怎么办 ?

我准确地说我的所有 js 文件(application.js 除外)都是空的。

我的宝石文件:

 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
4

7 回答 7

1

基于此链接:https ://stackoverflow.com/questions/12520456/execjsruntimeerror-on-windows-trying-to-follow-rubytutorial我认为您应该尝试查看哪个 .js 文件生成错误。

该行将 app/assets/javascripts 中的每个 .js.coffee 文件编译为 JavaScript,然后将其添加到您的布局中(但仅在开发模式下;在生产模式下,编译后的 js 将添加到您的 application.js 文件中)。有 require_tree 。不应该导致错误,所以不知何故,您遇到了与包含的文件之一有关的问题。您可以发布 app/assets/javascripts 目录中所有文件的列表吗?此外,您可以尝试完全删除 sessions.js.coffee 的内容并重新添加 //= require_tree 。并查看错误是否仍然存在。

于 2014-02-02T10:36:55.267 回答
0

试试这个: -

   add gem therubyracer to your gemfile and then do bundle install
于 2014-02-03T14:23:12.700 回答
0

Window 已经安装了 ExecRuntime 引擎,它不需要做任何事情。它应该自动拾取可用的最佳运行时。你甚至不需要安装 nodejs。

于 2014-02-04T09:42:56.900 回答
0

我不会花精力尝试为 Windows 打补丁。我建议安装 'therubyracer' gem [V8 Embedded] 或 node.js。如果问题仍然存在;请提供您的 Gemfile.lock 的副本,以便我们验证您的捆绑安装。

于 2014-02-07T07:03:44.657 回答
0

将 ExecJS 版本更改为 1.2.4

  1. 转到 Gemfile
  2. 键入 gem 'execjs', '1.2.4'
  3. 转到应用程序中的命令行:bundle install
  4. 繁荣
于 2014-04-29T00:59:48.340 回答
0

请不要在 Google Drive Syns 等特殊文件夹中开发 Rails 项目。这可能会帮助你。完整的细节在这里:http ://www.angkorbrick.com/rails-should-not-put-project-repository-in-google-drive-syns-folder/

于 2014-11-02T08:55:09.567 回答
-1

我“解决”了这个问题,我格式化了我的笔记本电脑并安装了 Windows 7 Ultimate ......

于 2014-03-21T22:04:00.670 回答