paypal / react-engine

a composite render engine for universal (isomorphic) express apps to render both plain react views and react-router views
Apache License 2.0
1.45k stars 130 forks source link

Cannot read property 'routes' of undefined #111

Closed DCKT closed 8 years ago

DCKT commented 8 years ago

Hi,

I'm following a tutorial based on this repo

When I run the server I got this error :

 if (!Router && createOptions.routes) {

TypeError: Cannot read property 'routes' of undefined

I'm using Node.js 5.0.0 by the way.

Any idea ? :)

DCKT commented 8 years ago

I've found the problem, it's because react-engine doesn't find the react-router module, so I install it with npm i react-router but this shouldn't happen right ?

Maybe it's because of npm3 ?

samsel commented 8 years ago

@DCKT react-router and react are decoupled from react-engine keeping npm3 in mind. please install them along side react-engine.

grawk commented 8 years ago

react-engine directly requires react-router. Therefore I think it should be defined as a direct dependency. Alternatively, because you can use react-engine without react-router functionality, the failure to resolve react-router shouldn't crash the application.

samsel commented 8 years ago

@grawk this was fixed with this PR and published. https://github.com/paypal/react-engine/pull/152 We can safely use react-engine without the need to install react-router anymore (truly optional). I am closing this issue for now. please feel free to re-open if anything is not working as expected.