LoginSignup
2
2

More than 3 years have passed since last update.

【Rails】Could not find a JavaScript runtime となる時の解決方法

Last updated at Posted at 2020-04-26

【事象】
bundle exec rake db:create すると下記のエラーが出る。

rake aborted!
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime.
See https://github.com/rails/execjs for a list of available runtimes.

【解決策】
Gemfileに下記を追加し、bundle installすると解決した。
image.png
ExecJSとは、RubyからJavaScriptコードを実行できるもの。
エラーの原因は、RubyからJavaScriptを呼び出す役割を持つ
ExecJSのランタイムが見つからないためのようなのでランタイムを追加してあげれば良いと推測。

ExecJSのことを https://github.com/rails/execjs
で見たが、gem therubyracerをインストールするとエラーになったので
また調べてgem mini_racerをインストールすると解決した。

2
2
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
2
2