erikras / react-redux-universal-hot-example

A starter boilerplate for a universal webapp using express, react, redux, webpack, and react-transform
MIT License
12k stars 2.5k forks source link

redux-router 1.0.0beta5 introduces Error: Cannot find module 'invariant' #650

Open bdefore opened 8 years ago

bdefore commented 8 years ago

From my heroku deploy logs on startup:

Dec 01 16:18:47 redux-universal-starter app/web.1:  [0] Error: Cannot find module 'invariant' 
Dec 01 16:18:47 redux-universal-starter app/web.1:  [0]     at Function.Module._resolveFilename (module.js:336:15) 
Dec 01 16:18:47 redux-universal-starter app/web.1:  [0]     at Function.Module._load (module.js:286:25) 
Dec 01 16:18:47 redux-universal-starter app/web.1:  [0]     at Module.require (module.js:365:17) 
Dec 01 16:18:47 redux-universal-starter app/web.1:  [0]     at require (module.js:384:17) 
Dec 01 16:18:47 redux-universal-starter app/web.1:  [0]     at Object.<anonymous> (/app/node_modules/redux-router/node_modules/history/lib/createMemoryHistory.js:9:18) 
Dec 01 16:18:47 redux-universal-starter app/web.1:  [0]     at Module._compile (module.js:434:26) 
Dec 01 16:18:47 redux-universal-starter app/web.1:  [0]     at Module._extensions..js (module.js:452:10) 
Dec 01 16:18:47 redux-universal-starter app/web.1:  [0]     at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-core/lib/api/register/node.js:214:7) 
Dec 01 16:18:47 redux-universal-starter app/web.1:  [0]     at Module.load (module.js:355:32) 
Dec 01 16:18:47 redux-universal-starter app/web.1:  [0]     at Function.Module._load (module.js:310:12) 

Reverting back to 1.0.0-beta4 fixed the issue.

colinshen commented 8 years ago

I updated node to 4.2.2 and npm to 3.5, reinstall everything to fix the problem.

rafanami commented 8 years ago

Having the same issue, node 4.2.2 and npm 2.14.7

hitripod commented 8 years ago

Having the same issue, node v0.10.26 and npm v2.5.1

przeor commented 8 years ago

Just FYI: I had the same problem on my system OS X Yosemite and this worked:

Please make sure that you are using node v4.2.2 and npm 3.5.1 Use Node Version Controler (NVM) if you need more versions of node on your machine.

(Before I had node v4.0.0 and npm v2.X - and had the issue described on top comment)

bdefore commented 8 years ago

I can verify that using npm3 fixes the issue. Per our package.json (https://github.com/erikras/react-redux-universal-hot-example/blob/master/package.json#L175) I've been running the Node 4.1.1 (which comes with npm 2.14.4). Unfortunately, our Travis tests are still passing since they don't run the webpack dev server.

If we are now requiring npm3 we should make note of that in the README and add it to engines in package.json:

Since this issue only affects development, Heroku deploys continue to work, but it would be wise to tell it to explicitly use npm3: https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version

kikoanis commented 8 years ago

It seems that rackt is considering replacing redux-router with redux-simple-router which is I think is the right way to go for its simplicity and ease of use

nickeblewis commented 8 years ago

Cool, same issue for me - upgraded node and npm as suggested, removed node_modules prior to running "npm install" once more.... works!

andresgutgon commented 8 years ago

I tried npm@3. It's super slow :/

andrewmclagan commented 8 years ago

ouch, this repo is hard to get going...

https://github.com/erikras/react-redux-universal-hot-example/pull/699

https://github.com/erikras/react-redux-universal-hot-example/issues/650