4

Rails 3.2.10 から 3.2.11 にアップグレードしたばかりで、アプリケーションに他の変更を加えていません。

突然、サイトが読み込まれなくなり、次のエラー メッセージが表示されます。

ExecJS::RuntimeError in Static_pages#home

Rails 3.2.11 の変更がこの問題を引き起こす理由を知っている人はいますか?

ExecJS::RuntimeError in Static_pages#home

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


  (in C:/Sites/av_reports/app/assets/javascripts/password_resets.js.coffee)
Extracted source (around line #11):

8:  <meta name="author" content="">
9:  
10:     <%= stylesheet_link_tag    "application", :media => "all" %>
11:     <%= javascript_include_tag "application" %>
12:     <%= csrf_meta_tags %>
13:     <%= render 'layouts/shim' %>
14:   </head>

私の /app/assets/javascripts/password_resets.js.coffee ファイルには 3 行のコメントアウトされたテキストが含まれているので、それは問題ではないと推測しています。

gem の依存関係などに変化はありますか?それが問題の原因になっている可能性はありますか?

編集

私のapplication.jsファイルは次のようになります。

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require_tree .
4

2 に答える 2

4

つまり...明らかに、これはRails 3.2.11のアップグレードの問題ではありませんでした。根本的な問題は、ExecJS が Windows 内で動作する方法にありました。現在、Windows 8 で開発環境を実行しています。

Rails 3.2.11 にアップグレードする前は、上記のエラー メッセージがサーバー ログに表示されていましたが、サーバーは停止しませんでした。Rails 3.2.11 では、ページが読み込まれなくなりました。

解決策は、Ruby1.9.3\lib\ruby\gems\1.9.1\gems\execjs-1.4.0\lib\execjs\runtimes.rb ファイルを編集することでした。

(元の動作しないコード):

JScript = ExternalRuntime.new(
    :name        => "JScript",
    :command     => "cscript //E:jscript //Nologo //U",
    :runner_path => ExecJS.root + "/support/jscript_runner.js",
    :encoding    => 'UTF-16LE' # 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
)

https://github.com/sstephenson/execjs/issues/81#issuecomment-9892952のコメント スレッドに感謝します。

この問題のヘルプについては、 https ://stackoverflow.com/a/14119187/1757424 でのディスカッションを参照してください。

于 2013-01-11T19:55:52.063 に答える
0

問題がありますが、Ruby2.0.0を使用していました

解決策は Ruby2.0.0\lib\ruby\gems\2.0.0\gems\execjs-2.2.1\lib\execjs\runtimes.rb を編集することです

于 2014-07-06T15:57:22.263 に答える