RailsTutorial.org – 用户中的ExecJS :: RuntimeError #index

我正在关注Michael Hartl的Ruby on Rails教程,在第二章中,我们设置了一个演示应用程序。 我遇到了错误,我无法找到原因!

我确保遵循教程中的每个命令:

  1. Ran rails new to demo_app创建项目
  2. 根据需要更新了gem文件
  3. 执行rails generate scaffold User name:string email:string
  4. 使用bundle exec rake db:migrate
  5. 启动服务器 – rails s
  6. http://localhost:3000/显示正确
  7. 当我尝试导航到http://localhost:3000/users/ ,出现此错误

在此处输入图像描述

任何人都可以了解设置为什么会起作用?!

这个问题与这个问题重复

你会在这里找到答案ExecJS :: RuntimeError in Users#index(RoR)

安装Node.js的步骤

Go to nodejs网站 and download the installer

  Click on the downloaded file to run the install wizard. Click Next at each step to accept the defaults. Reboot your computer. Once your computer is back up, load Command Prompt with Ruby and Rails OR simple command prompt and... Type this in the terminal: node -v