Samuel Bird
Samuel Bird

Reputation: 47

What do I need to do to get the blog to work in rails 4.2?

I have just installed rails 4.2 . I have found this tutorial for making a quick blog: https://www.reinteractive.net/posts/32-ruby-on-rails-3-2-blog-in-15-minutes-step-by-step . However, it uses rails 3.2 . I have done everything that it says up to rake db:migrate and yet, when I run the server, I just get an error page. What has changed since 3.2? what do I now have to do to do the same thing?

error: 'ExecJS::ProgramError in Posts#index' TypeError: Object doesn't support this property or method (in C:/Ruby193/lib/ruby/gems/1.9.1/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)

EDIT:

On a side note, I can't even follow the official ruby on rails tutorial because when I run the server, after changing the root to root 'welcome#index' , I just get a page not found error.

Are there any tutorials for rails 4.2?

Upvotes: 1

Views: 5543

Answers (3)

Jonathan Yee
Jonathan Yee

Reputation: 1977

There's some info here: ExecJS::RuntimeError in Users#index (RoR)

What I found when I looked into this problem was that in CoffeeScript there's a checkin here that I think broke things for Windows (under certain versions of the cscript runtime): https://github.com/jashkenas/coffeescript/blob/28c07d30cbd2add7ee762c7d532b2c9c972e441a/lib/coffee-script/parser.js

On line 563 it's doing an Object create(lexer) which fails with the error ActionView::Template::Error (TypeError: Object doesn't support this property or method.

Rolling back to CoffeeScript 1.8.0 (before this change) works around this problem. As others have stated in this answer and elsewhere, using a different runtime will workaround this problem too.

To roll back to CoffeeScript 1.8.0 add this to your gemfile:

gem 'coffee-script-source', '1.8.0'

And run these commands:

gem update 'coffee-script-source'
bundle update 'coffee-script-source'

Restart your server and it should be working.

Upvotes: 4

dd_hk
dd_hk

Reputation: 110

I had exactly the same ExecJS::ProgramError on Windows. The only solution that really helped was provided by KeithP here: Rails-4, ExecJS::ProgramError in Pages#welcome, i.e.,

Rollback to gem 'coffee-script-source', '1.8.0'.

Upvotes: 4

Tom
Tom

Reputation: 520

This should solve your problem:
Add gem 'therubyracer', '~> 0.12.1' into your gemfile (or uncomment it - should be already there...)
Then run bundle install

Hope this helps.

Upvotes: 1

Related Questions