简体   繁体   中英

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.

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

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

Replace therubyracer by mini_racer in Gemfile :

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

And then:

$ bundle install

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

安装 NodeJS 解决了我的问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM