2017-01-02 21 views
1

gem 'uglifier'を読み込もうとしましたが、エラーが発生しました。'uglifier'のためRuby-on-rails Webアプリケーションを起動できませんでした

Gem Load Error is: wrong argument type Class (expected Module) 
Backtrace for gem load error is: 

/usr/local/lib/ruby/gems/2.4.0/gems/therubyracer-0.12.2/lib/v8/conversion.rb:23:in `include' 
/usr/local/lib/ruby/gems/2.4.0/gems/therubyracer-0.12.2/lib/v8/conversion.rb:23:in `block (2 levels) in <top (required)>' 
/usr/local/lib/ruby/gems/2.4.0/gems/therubyracer-0.12.2/lib/v8/conversion.rb:22:in `class_eval' 
/usr/local/lib/ruby/gems/2.4.0/gems/therubyracer-0.12.2/lib/v8/conversion.rb:22:in `block in <top (required)>' 
/usr/local/lib/ruby/gems/2.4.0/gems/therubyracer-0.12.2/lib/v8/conversion.rb:21:in `each' 
/usr/local/lib/ruby/gems/2.4.0/gems/therubyracer-0.12.2/lib/v8/conversion.rb:21:in `<top (required)>' 
/usr/local/lib/ruby/gems/2.4.0/gems/therubyracer-0.12.2/lib/v8.rb:22:in `require' 
/usr/local/lib/ruby/gems/2.4.0/gems/therubyracer-0.12.2/lib/v8.rb:22:in `<top (required)>' 
/usr/local/lib/ruby/gems/2.4.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:108:in `require' 
/usr/local/lib/ruby/gems/2.4.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:108:in `available?' 
/usr/local/lib/ruby/gems/2.4.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:63:in `each' 
/usr/local/lib/ruby/gems/2.4.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:63:in `find' 
/usr/local/lib/ruby/gems/2.4.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:63:in `best_available' 
/usr/local/lib/ruby/gems/2.4.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:57:in `autodetect' 
/usr/local/lib/ruby/gems/2.4.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>' 
/usr/local/lib/ruby/gems/2.4.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>' 
/usr/local/lib/ruby/gems/2.4.0/gems/uglifier-3.0.4/lib/uglifier.rb:5:in `require' 
/usr/local/lib/ruby/gems/2.4.0/gems/uglifier-3.0.4/lib/uglifier.rb:5:in `<top (required)>' 
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `require' 
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `block (2 levels) in require' 
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `each' 
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `block in require' 
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `each' 
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `require' 
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler.rb:106:in `require' 
/var/www/geia.junyuzhu.com/public_html/testapp/config/application.rb:7:in `<top (required)>' 
/var/www/geia.junyuzhu.com/public_html/testapp/config/environment.rb:2:in `require_relative' 
/var/www/geia.junyuzhu.com/public_html/testapp/config/environment.rb:2:in `<top (required)>' 
config.ru:3:in `require_relative' 
config.ru:3:in `block in <main>' 
/usr/local/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval' 
/usr/local/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize' 
config.ru:1:in `new' 
config.ru:1:in `<main>' 
/usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `eval' 
/usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `preload_app' 
/usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>' 
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>' 
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>' 
Bundler Error Backtrace: 
(Bundler::GemRequireError) 
    /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require' 
    /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:90:in `block (2 levels) in require' 
    /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `each' 
    /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `block in require' 
    /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `each' 
    /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `require' 
    /usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.13.7/lib/bundler.rb:106:in `require' 
    /var/www/geia.junyuzhu.com/public_html/testapp/config/application.rb:7:in `<top (required)>' 
    /var/www/geia.junyuzhu.com/public_html/testapp/config/environment.rb:2:in `require_relative' 
    /var/www/geia.junyuzhu.com/public_html/testapp/config/environment.rb:2:in `<top (required)>' 
    config.ru:3:in `require_relative' 
    config.ru:3:in `block in <main>' 
    /usr/local/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval' 
    /usr/local/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize' 
    config.ru:1:in `new' 
    config.ru:1:in `<main>' 
    /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `eval' 
    /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `preload_app' 
    /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>' 
    /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>' 
    /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>' 

私はnodejsをインストールして、Apacheサーバーを再起動しようとしました。この問題は役に立たない。

bundle show uglifierは私がuglifier正しくインストールされていると仮定し

/usr/local/lib/ruby/gems/2.4.0/gems/uglifier-3.0.4 

を与えます。

また、gem 'therubyracer', platforms: :rubyはGemfileでコメントが外されています。

どうすればこの問題を解決するかわかりません。

答えて

4

JSランタイムの実行中またはJSインタプリタを必要としますRubby 2.4とRuby 2.4です。 Ruby 2.4との互換性については、issue trackerのhttps://github.com/cowboyd/therubyracer/issues/430で追跡される追加の問題がいくつかあります。

Rubyの以前のバージョンを使用する必要があります。新版が発売されるまで2.3.3。

ところで:Ruby 2.4とまだ互換性のないいくつかの宝石があります。新しいリリース後に大量の互換性の問題が発生しないようにするには、リリース初日にアップグレードしないことをお勧めします。

+0

ありがとうございます。それは私の問題を解決した。 – Junyu

0

デフォルトのレールGemfileでは、宝石therubyracerの行がコメントアウトされています。コメントを外すと、その宝石を手に入れることになります。 (私のために問題を解決した)称賛

sudo apt-get install nodejs 

OR

ランはUglifierは、JSのラッパーであり、これはa known issueである

関連する問題