Current ExecJS runtime does't support ES6
Asked Answered
F

5

11

rake assets:precompile for my rails project throws below error:

rake aborted! Current ExecJS runtime does't support ES6. Please install latest Node.js.

Below is the environment information:

rails -v
Rails 5.0.7

ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

node -v
v6.11.1

I tried reinstalling all my gems. But still, the error comes. OS is RHEL.

Faggoting answered 17/7, 2018 at 10:39 Comment(2)
have you installed node.js already, which command you used. It's required to compile the Js codeEdmondo
No we did not install node js. It came by default in the OS offering. OS is RHEL 7.2Faggoting
A
19

i had the same problem after upgrading autoprefixer-rails to Version 9.0.0. i fixed it by setting autoprefixer-rails to a pre 9 version:

gem 'autoprefixer-rails', '8.6.5'

in my Gemfile

Archaimbaud answered 17/7, 2018 at 13:6 Comment(1)
Same problem and solution using Rails 4.2Davidoff
F
12

I had a similar problem after upgrading to Rails 5.2

The solution for me was to add this line

 # make the ExecJs use NodeJs
 ENV['EXECJS_RUNTIME'] = 'Node'

In this file

config/boot.rb

Then restart the rails server

Freiman answered 21/9, 2018 at 21:5 Comment(1)
Thanks Quy, I am glad I could help :)Freiman
P
7

Replace therubyracer by mini_racer in Gemfile:

# gem 'therubyracer', platforms: :ruby
gem 'mini_racer', platforms: :ruby

And then:

$ bundle install
Preamplifier answered 19/7, 2018 at 16:5 Comment(0)
A
5

There's been a similar issue opened in the Autoprefixer-rails gem regarding this error, but it was thrown from an ActionView Template. keep an eye out for a response from the contributor:

https://github.com/ai/autoprefixer-rails/issues/137

Aeschylus answered 17/7, 2018 at 14:8 Comment(0)
E
-2

Installing NodeJS solved my problem.

Electrotonus answered 2/12, 2020 at 15:16 Comment(1)
This is not an answer, please consider leaving a comment instead.Occupant

© 2022 - 2024 — McMap. All rights reserved.