7
9

More than 5 years have passed since last update.

Rails s するとCould not find a JavaScript runtimeって怒られる問題

Posted at

問題

rails sすると下記のエラーが出てYou're on Railsできない。

Gem Load Error is: Could not find a JavaScript runtime. 
See https://github.com/rails/execjs for a list of available runtimes.

要するにJavaScriptのランタイムが無いよってことらしい。

解決策

Gemifile
# gem 'therubyracer', platforms: :ruby

これのコメントアウトを外す。
もしくは何かしらのJsエンジンをインストールする。

解説

therubyracerはJavascriptのエンジンであるV8 JavaScript EngineをRubyから使えるようにするgem。
(更にそのままでは使えない環境の場合は、環境に合ったバイナリファイルを持ってきてくれるスグレモノ)
ただ既にnode.jsとかがインストールされている環境では不要なため、デフォルトではコメントアウトされているらしい。

7
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
9