简体   繁体   English

如何使用Windows操作系统修复Ruby on Rails应用程序的运行时错误?

[英]How can I fix a Runtime Error for a Ruby on Rails app using a Windows Operating System?

I'm trying to run my homepage of my rails app in the browser, but when I run the page I get a runtime error saying that "Current ExecJS runtime does't support ES5. Please install node.js". 我正在尝试在浏览器中运行我的rails应用程序的主页,但是当我运行页面时,我收到运行时错误,说“Current ExecJS运行时不支持ES5。请安装node.js”。

How can I fix this error? 我该如何解决这个错误?

Pages#home中的运行时错误

Here's my Gem file: 这是我的Gem文件:

 source 'http://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'bootstrap-sass'
gem 'sdoc', '~> 0.4.0',          group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem 'autoprefixer-rails', '~> 5.0.0.2'

Here's what returned on my command line: 这是我的命令行返回的内容:

$ rails server
=> Booting WEBrick
=> Rails 4.1.8 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0
.0.1 (--binding option)
=> Ctrl-C to shutdown server
[2015-01-24 14:32:37] INFO  WEBrick 1.3.1
[2015-01-24 14:32:37] INFO  ruby 2.1.5 (2014-11-13) [i386-mingw32]
[2015-01-24 14:32:37] INFO  WEBrick::HTTPServer#start: pid=4284 port=3000


Started GET "/" for 127.0.0.1 at 2015-01-24 14:37:02 -0500
Processing by Rails::WelcomeController#index as HTML
  Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/l
ib/rails/templates/rails/welcome/index.html.erb (41.0ms)
Completed 200 OK in 320ms (Views: 235.0ms | ActiveRecord: 0.0ms)


Started GET "/pages/home" for 127.0.0.1 at 2015-01-24 14:41:10 -0500
Processing by PagesController#home as HTML
  Rendered pages/home.html.erb within layouts/application (1.0ms)
Completed 500 Internal Server Error in 419ms

ActionView::Template::Error (Current ExecJS runtime does't support ES5. Please i
nstall node.js.
  (in c:/Users/Doesha/Desktop/pinteresting/app/assets/stylesheets/application.cs
s)):
    2: <html>
    3: <head>
    4:   <title>Pinteresting</title>
    5:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolink
s-track' => true %>
    6:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => tr
ue %>
    7:   <%= csrf_meta_tags %>
    8: </head>
  app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_ht
ml_erb__829465221_47419968'


  Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.0ms)
  Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
 (2.0ms)
  Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within
 rescues/layout (178.0ms

)

What's the correct way to install the node.js gem? 安装node.js gem的正确方法是什么?

它不是宝石,你必须从http://nodejs.org/安装node.js

After installing the node.js , the issue might not be get fixed at once. 安装node.js后 ,问题可能无法立即得到修复。 You need to reboot the system once or twice to set the update and the issue will be solved. 您需要重启系统一次或两次以设置更新,问题将得到解决。 Please refer this thread . 请参考这个主题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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