OpenShift railsのgenerateでエラー

OpenShiftでrailsプロジェクトを作成して、git cloneしてローカルにプロジェクトを取り込み

bundle installしてrails generateコマンドを実行するとエラーになりました。

なぜいきなり!!

その時の回避方法をメモします。

実行したコマンド

bundle exec rails generate controller sentence

エラーログ

``text:log /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:inautodetect’: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) from /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/execjs-1.4.0/lib/execjs.rb:5:in <module:ExecJS>' from /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/execjs-1.4.0/lib/execjs.rb:4:in’ from /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in require' from /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in’ from /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in require' from /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in’ from /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in require' from /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in’ from /home/igawa/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in require' from /home/igawa/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:inblock (2 levels) in require’ from /home/igawa/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in each' from /home/igawa/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:inblock in require’ from /home/igawa/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in each' from /home/igawa/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:inrequire’ from /home/igawa/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in require' from /home/igawa/repo/proofreadingchecker/config/application.rb:7:in’ from /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:24:in require' from /home/igawa/repo/proofreadingchecker/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:24:in’ from script/rails:6:in require' from script/rails:6:in


# 対応方法

Gemfileに以下のライブラリを追加して、もう一度`bundle install`すると正常に、`generate`を実行できました。

初めからGamefileに追加してくれてもいいのにorz

`Gamefile`

gem ‘therubyracer’ ```

以上でーす。

comments powered by Disqus