1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Railsサーバー起動時の『Could not find a JavaScript runtime』エラー対応方法

Posted at

新規でRailsアプリケーションを作成する際、サーバーを起動させようとしたら以下のようなエラーが発生しました。

/myapp/vendor/bundle/ruby/2.6.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. 
See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

エラーの原因は、RubyからJavaScriptを呼び出す役割を持つExecJSのランタイムが見つからないためのようです。

ExecJSがサポートしているランタイムは以下の通りです。1

  • therubyracer
  • therubyrhino
  • Duktape.rb
  • Node.js
  • Apple JavaScriptCore
  • Microsoft Windows Script Host (JScript)
  • Google V8
  • mini_racer

Node.jsをインストール後、再度サーバーを起動させたら問題は解決しました。

  1. https://github.com/rails/execjs

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?