What should I do if I get "Could not find a JavaScript runtime." while running the test?

Asked 5 months ago, Updated 5 months ago, 10 views

When I was developing Rails, I was developing using rbenv, but there was a little trouble, so I renewed my development environment.

If you run ./bin/rake test after doing bundle install, you will get the following error:

ActionView::Template::Error:cSee https://github.com/sstephenson/execjs for a list of available runtimes.
  test/controllers/foobar_controller_test.rb:16:in`block in<class:FoobarsControllerTest>'

I remember that the above error did not occur in the previous environment.Why do we need execjs like this?Also, what is the fundamental solution to this?

For your information, I tried bundle install in the following rbenv environment, but I get an error using any of them:

  • ruby 2.1.0
  • ruby 2.2.0
  • ruby 2.2.1

If there is a correct solution to this error, please let me know.

ruby ruby-on-rails

2022-09-30 12:09

1 Answers

"See https://github.com/sstephenson/execjs for a list of available runtime." or "execjs node.js" gives you a lot of similar errors.
My acquaintance had a problem with the same error before.

I remember that it was fixed after reinstalling node.js.
(It says "new development environment", so I think we need to set up that kind of middleware.)

I'll give you a few links to the sources, so you can try them out.

Please let me know what would have been effective if it went well.

2022-09-30 12:09

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.