Michael Hartl 的 Ruby on Rails 教程,toy_app 用户导览 [英] Michael Hartl's Ruby on Rails Tutorial, toy_app user tour

查看:45
本文介绍了Michael Hartl 的 Ruby on Rails 教程,toy_app 用户导览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 Michael Hartl 的 Ruby on Rails 教程,直到第 2.2.1 节开始,所有步骤都按预期工作.

I'm working through Michael Hartl's Ruby on Rails Tutorial and all steps have worked as expected up to the start of section 2.2.1.

第一句话说访问根将显示默认的 Rails 页面.但它没有;它显示hello world",因为第 2.1 节中的教程让我们在部署到 Heroku 之前将根定义为 application#hello.如果我转到 http://localhost:3000/users/,我会收到一个错误:

The first sentence says visiting the root will display the default Rails page. But it doesn't; it shows "hello world" because the tutorial in section 2.1 has us define the root to be application#hello right before deploying to Heroku. If I go to http://localhost:3000/users/, I get an error:

ExecJS::ProgramError in Users#index

ExecJS::ProgramError in Users#index

显示C:/Users/dfretz/dfretz/Coursera/Rails_tutorial/toy_app/app/views/layouts/application.html.erb其中第 6 行提出:

Showing C:/Users/dfretz/dfretz/Coursera/Rails_tutorial/toy_app/app/views/layouts/application.html.erb where line #6 raised:

类型错误:对象不支持此属性或方法

TypeError: Object doesn't support this property or method

由于这是脚手架生成的代码,我不知道如何解决这个问题,甚至不知道您需要查看哪些文件才能提供帮助.

Since this is scaffolding-generated code, I don't know how to fix this, or even what files you'd need to see in order to help.

谁能告诉我我做错了什么?

Can someone please tell me what I did wrong?

推荐答案

由于您是新手,以下是如何调试:

Since you're new, here's how to debug it:

这是你的错误:

C:/Users/dfretz/dfretz/Coursera/Rails_tutorial/toy_app/app/views/layouts/application.html.erb where line #6

C:/Users/dfretz/dfretz/Coursera/Rails_tutorial/toy_app/app/views/layouts/application.html.erb where line #6

这为您提供了一个要查看的特定文件和一个要观察的行.

This gives you a specific file to look at, and a line to observe.

根据我的经验,application.html.erbline 6 将位于应用程序的 数据中;我有一种感觉,它将是 Javascript 文件.

In my experience, line 6 of application.html.erb is going to be in the <meta> data of the app; I have a feeling that it's going to be the Javascript files.

--

事实上,正如我们从错误中看到的:

In fact, as we can also see from the error:

ExecJS::ProgramError

ExecJS::ProgramError

这基本上表明我们正在处理一个 JS 问题.

This basically suggests we're dealing with a JS problem.

你会遇到很多 JS 问题;这似乎是一个深层次的问题(可能与 Windows 8)... ExecJS::Users#index (RoR) 中的运行时错误

There are a number of JS problems you can get; this one seems to be a deep-set issue (probably with Windows 8)... ExecJS::RuntimeError in Users#index (RoR)

底线是我认为您需要安装 NodeJS,或者分配另一个 JS 运行时.遇到问题时,我刚刚安装了 NodeJS...

The bottom line is I think you need to install NodeJS, or assign another JS runtime. I just installed NodeJS when I had the issue...

您可能想查看此资源并按照以下步骤操作:如何在 Windows 7 中使用 Nodejs?

You'll probably want to look at this resource and follow the steps: How can I use Nodejs with Windows 7?

这篇关于Michael Hartl 的 Ruby on Rails 教程,toy_app 用户导览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆