Many error lines ... Rails server does not start 2. "Autodetect': Could not find a JavaScript runtime."

Occurrence background </ font>

When I try to start the application after a long time, the application does not start.

  • This is a series of articles on "The server does not start".

I got the following error:

Traceback (most recent call last):
	61: from bin/rails:3:in `<main>'
	60: from bin/rails:3:in `load'
-------Partially omitted
	 3: from /Users/ichikawadaisuke/projects/krown/vendor/ruby/2.5.0/gems/bootsnap-1.4.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
	 2: from /Users/ichikawadaisuke/projects/krown/vendor/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<main>'
	 1: from /Users/ichikawadaisuke/projects/krown/vendor/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/Users/ichikawadaisuke/projects/krown/vendor/ruby/2.5.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)

Correspondence method </ font>

-① Try to execute "bundle install --path vendor" locally

Fetching libv8 3.16.14.19
Installing libv8 3.16.14.19 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

In file included from ../src/allocation.cc:33:
../src/utils.h:33:10: fatal error: 'climits' file not found
#include <climits>
         ^~~~~~~~~
1 error generated.
(abridgement)

The above error occurs.

-② Execute the following command according to the instruction of the error wording.

CMD> gem install libv8 -v '3.16.14.19' --source 'https://rubygems.org/'

The same error message as ① is output and the command fails.

――③ Currently, mac-os is using "Catalina v10.15.4". When I checked, there was information that there was no backward compatibility, so execute the following command to make it compatible.

CMD> brew install v8-315

Now that you have run the brew command and installed it, change the settings of your local application.

CMD>bundle config --local build.therubyracer --with-v8-dir=$(brew --prefix v8-315)

Finally I ran the budle installation locally. The issue has been resolved and the Rails server can now be started.

Recommended Posts