Michael Hartl's Ruby on Rails Tutorial, toy_app user tour

守給你的承諾、 提交于 2020-01-06 01:29:05

问题


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.

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

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?


回答1:


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


This is your error:

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.

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

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

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)

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...

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



来源:https://stackoverflow.com/questions/33194173/michael-hartls-ruby-on-rails-tutorial-toy-app-user-tour

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!