Error: Cannot find module 'react/lib/invariant'

1.7k views Asked by At

Not sure if any one of you have ever faced this issue. I have tried checking various sources online but nothing solved my issue.

I am following a tutorial on how to create a Meteor+ionic+react application from this link

https://medium.com/@SamCorcos/meteor-react-ionic-mobile-app-part-1-the-basic-template-9355ebf3397f#.qtl4fl5st

when i add the line

ReactRouter=require("react-router");

inside app.browserify.js and run the application, i get the following error.

Error: Cannot find module 'react/lib/invariant'

I am using following versions

react                 0.14.3
cosmos:browserify     0.9.3
meteorhacks:npm       1.5.0
npm-container         1.2.0+

I am surely missing something thing here. Can anyone help.

Thanks,

Sri TejN

2

There are 2 answers

0
Sri Tej Narala On

I found the solution myself. Just install the ReactRouter that is present in the meteor packages and do not include the line “ReactRouter = require(“react-router”);” in the file “ app.browserify.js”. But you can use the variable ReactRouter anywhere else in the code.

0
paranoico On

Just to confirm, in my case the solution also worked and added ReactRouter package:

meteor add reactrouter:react-router

Then commenting out line:

//ReactRouter = require("react-router");

In file lib/app.browserify.js and running Meteor again fixed the problem.

Thanks Sri Tej Narala.