bananaoomarang / isomorphic-redux

Isomorphic Redux demo, with routing and async actions
https://medium.com/@bananaoomarang/handcrafting-an-isomorphic-redux-application-with-love-40ada4468af4
MIT License
455 stars 87 forks source link

npm run start is not working #60

Closed govind999 closed 8 years ago

govind999 commented 8 years ago

Hi All,

I am trying to execute this on windows and its not working. This works fine

webpack-dev-server --progress --color

but when i run

node index.js it throws following error

D:\poc\isomorphic-redux-master>node index.js module.js:327 throw err; ^ Error: Cannot find module 'routes' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object. (server.jsx:6:1) at Module._compile (module.js:409:26) at loader (D:\poc\isomorphic-redux-master\node_modules\babel-register\lib\node.js:148:5) at Object.require.extensions.(anonymous function) as .jsx at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12)

i tried this but it didn't work cross-env NODE_PATH=$NODE_PATH:./shared node --harmony .

govind999 commented 8 years ago

i got this working by doing this, but i have to go and update all the paths to resolve properly. there were many more like this ../actions/TodoActions';

"scripts": { "start": "cross-env NODE_ENV=DEV NODE_PATH=$NODE_PATH:./shared node --harmony .", "dev": "npm run start & webpack-dev-server --progress --color", "build": "webpack --progress --color -p --config webpack.prod.config.js" },

bananaoomarang commented 8 years ago

Hi, sorry about this issue. I have no Windows machine to test it on, I'm afraid, but I'll do my best.

This issue is likely of use (it's closed so that's why you may not have seen it).

I suspect (though I'm just guessing) that the problem is the use of $NODE_PATH to keep what was previously set in the path is the issue. I would also expect cross-env to deal with that. Perhaps you have to wrap in quotes or escape something somehow.

Anyway, the scripts provided in the linked issue should work. Even if it's not the cleanest solution it should solve the problem far nicer than replacing the paths. Hope this works!

govind999 commented 8 years ago

@bananaoomarang

Thanks for your response, i still don't understand one thing. How come below command starting the server.

NODE_PATH=$NODE_PATH:./shared node --harmony

It should be something like node index.js right?? nowhere in the code it says node index.js

peter-mouland commented 8 years ago

i think if node doesn't get given a file it assumes index.js

the harmony flag is out of date now isn't it? should just use node v6 instead?