Skip to content

React::ServerRendering::PrerenderError in #827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Nov 3, 2017 · 4 comments
Closed

React::ServerRendering::PrerenderError in #827

ghost opened this issue Nov 3, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Nov 3, 2017

I am using Rails 5 with react-rails gem. I want to use server-side rendering, but I see this error:

React::ServerRendering::PrerenderError in Home#index

Encountered error "# ExecJS::ProgramError: TypeError: Cannot read property 'serverRender' of undefined" when prerendering Main with {}

This is javascripts/components.jsx:

class Main extends React.Component{ render(){ return ( <h1>Hello</h1> ); } }
and this is the view:
<%= react_component('Main', {}, {prerender: true}) %>
Without prerender option, everything works.

@BookOfGreg
Copy link
Member

BookOfGreg commented Nov 3, 2017

Hello @vladi160,

Are you using Webpacker or Sprockets?
Which version of React-Rails and which version of ReactRailsUJS do you have?

I'll help you if I can but I need to know more in order to replicate this issue. 👍

@ghost
Copy link
Author

ghost commented Nov 4, 2017

Fixed. I execute command rails generate react:install and place components in /assets/javascripts/componets

@ghost ghost closed this as completed Nov 4, 2017
@rolandoalvarado
Copy link

Thanks @ghost this solve my problem too.

@rolandoalvarado
Copy link

This solves my problem too. +1 @ghost

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants