当前位置 : 主页 > 编程语言 > ruby >

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

来源:互联网 收集:自由互联 发布时间:2021-06-23
我正在尝试在浏览器中运行我的rails应用程序的主页,但是当我运行页面时,我收到运行时错误,说“Current ExecJS运行时不支持ES5.请安装node.js”. 我该如何解决这个错误? 这是我的Gem文件:
我正在尝试在浏览器中运行我的rails应用程序的主页,但是当我运行页面时,我收到运行时错误,说“Current ExecJS运行时不支持ES5.请安装node.js”.

我该如何解决这个错误?

这是我的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'

这是我的命令行返回的内容:

$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

)

安装node.js gem的正确方法是什么?

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