Vip*_*mar 9 rake ruby-on-rails node.js execjs ruby-on-rails-5
rake assets:precompile 我的rails项目抛出以下错误:
耙子流产了!当前的ExecJS运行时不支持ES6.请安装最新的Node.js.
以下是环境信息:
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
Run Code Online (Sandbox Code Playgroud)
我尝试重新安装我的所有宝石.但是,错误仍然存在.操作系统是RHEL.
任何建议将不胜感激.
pfe*_*fan 17
将autoprefixer-rails升级到9.0.0后,我遇到了同样的问题.我通过将autoprefixer-rails设置为pre 9版本来修复它:
gem 'autoprefixer-rails', '8.6.5'
Run Code Online (Sandbox Code Playgroud)
在我的Gemfile中
升级到Rails 5.2后,我遇到了类似的问题
我的解决方案是添加这一行
# make the ExecJs use NodeJs
ENV['EXECJS_RUNTIME'] = 'Node'
Run Code Online (Sandbox Code Playgroud)
在这个文件中
配置/的boot.rb
然后重启rails服务器
小智 5
Autoprefixer-rails gem 中也有一个关于此错误的类似问题,但它是从 ActionView 模板中抛出的。请留意贡献者的回复:
https://github.com/ai/autoprefixer-rails/issues/137
更换therubyracer用mini_racer在Gemfile:
# gem 'therubyracer', platforms: :ruby
gem 'mini_racer', platforms: :ruby
Run Code Online (Sandbox Code Playgroud)
然后:
$ bundle install
Run Code Online (Sandbox Code Playgroud)