Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Current ExecJS runtime does't support ES6

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.

like image 262
Vipul Kumar Avatar asked Jul 17 '18 10:07

Vipul Kumar


People also ask

Can I use ES6 with %therubyracer (V8) runtime?

therubyracer (V8) runtime does’t support ES6. Please update or replace your current ExecJS runtime. I can't use mini_racer. Can you help me please?)

Does execjs support rubyracerruntime?

Then that wouldn't work due to this error: ExecJS::RubyRacerRuntime is not supported. Please replace therubyracer with mini_racer in your Gemfile or use Node.js as ExecJS runtime.

What is ES5 code in JavaScript?

ES5 code is the JS syntax style that is readable to node.js, such as module.exports or var module = require ('module') . Note that in today’s time, almost 99% of ES6+ syntax can be used in Node.js. This is where the package called babel shines.

Does Autoprefixer JS code need to be updated to ES6?

@jcoyne updating ExecJS runtime is always the good idea ;). Anyway, Autoprefixer JS code just needs ES6. Sorry, something went wrong. Sorry, something went wrong. Maybe we need to change error text. Do you want to send PR? Sorry, something went wrong. Sorry, something went wrong. @jankmet @caiotarifa does somebody want to make warning smarter?


2 Answers

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

like image 192
Ahmed Elkoussy Avatar answered Sep 22 '22 12:09

Ahmed Elkoussy


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

like image 44
Kara Carrell Avatar answered Sep 21 '22 12:09

Kara Carrell