1
0

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 3 years have passed since last update.

Could not find a JavaScript runtimeの解決法

Posted at

環境

MacOS BigSur 11.5.2
docker 20.10.6
ruby 3.0.2
rails 6.1.4

エラー

CircleCIでbuild中database setupにて引っかかりました

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

試したこと

https://github.com/rails/execjs にアクセスし、$ gem install execjsを実行
②node.jsは元々入っていたがアンインストール、再度インストール
③Gemfileにtherubyracerexecjsを追加、docker-compose run web bundle installまたはdocker-compose build

複数の記事を調べ以上3つを試すもエラーは消えず。

解決法

Gemfileにmini_racerを追加→docker-compose run web bundle installまたはdocker-compose build

私が試したtherubyracerexecjsではなくmini_racerが最近では使われているようです。
なのでこれからruntimeを動かしたい時はmini_racerを使いましょう。

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?