健康意識の高まり

いろんなメモなど

rails server 時に `autodetect': Could not find a JavaScript runtime が出たら。

rails server したときに

`autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

と出た時の対処法(といっても公式ドキュメントにそのまんま書いてあるけど・・・)。


Ruby on Rails Guides: Getting Started with Rails の 4.1 Starting up the Web Server に

Compiling CoffeeScript to JavaScript requires a JavaScript runtime and the absence of a runtime will give you an execjs error. (中略) Rails adds the therubyracer gem to Gemfile in a commented line for new apps and you can uncomment if you need it.

とある通り、 therubyracer を gem でインストールする記述が Gemfile 内でコメントアウトされてるそうなので、コメントアウトを外す。

gem 'therubyracer', :platforms => :ruby

そして bundle install しなおす。

bundle install

再び rails server すれば起動する(はず)。