问题
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