dvdzkwsk / react-redux-starter-kit

Get started with React, Redux, and React-Router.
MIT License
10.29k stars 2.2k forks source link

Having trouble with deployment in Windows #96

Closed jmarlow4 closed 9 years ago

jmarlow4 commented 9 years ago

I'd like to deploy a compiled server but, for some reason, when I type 'node dist/server/index' nothing happens.

untitled

I've set the node_env to production, even in the .babelrc file. Did anyone else have this issue?

Is there a script to just run this code in the package.json file?

dvdzkwsk commented 9 years ago

Sorry if this is a bit confusing, the file in ~/dist/server is not actually the server, it's the React application compiled for consumption by the server (see https://github.com/davezuko/react-redux-starter-kit/issues/61).

What you're probably looking for is the script in ~/bin/server, which you can run with npm server:start. Let me know if that doesn't fix things.

jmarlow4 commented 9 years ago

That worked! But I get redux-devtools popping up with it and that shouldn't be there in production. Is that supposed to be there?

dvdzkwsk commented 9 years ago

You'll have to recompile the bundle, the only time the environment affects the React application is during compile time (or with webpack-dev-server). So it would be NODE_ENV=production npm run compile && npm run server:start. See if that works.

jmarlow4 commented 9 years ago

That also worked. I didn't need to override it with --no_debug. I did have to separate the commands set NODE_ENV=production and npm run server:start in order to get that to work as well. They're a little different so it would work with the way windows does environment variables and NPM scripts.

Seriously, excellent work with this. I'm really impressed by everything. I appreciate that the starting app is lean yet all the utilities and packages included are the best right now. I love your choice of Koa over Express, even though I'm more comfortable and familiar with Express, I love how React-Router is built in. Dude, this rocks so hard! This is exactly what I've been looking for. And now that I have it purring along I can finally conquer the world! HAR HAR HAR!

But seriously, thanks :)

jmarlow4 commented 9 years ago

The reason it wasn't working before is because I was messing with the .babelrc file when I could have just set env variables with the console. To make it work I rimraffed the entire folder, recloned the repo, freshly installed all the packages, set the correct environment variables, and then ran the scripts in their logical order (as specified on your readme). THEN it worked.

dvdzkwsk commented 9 years ago

Hooray for stuff working! Haha. Thanks so much, it means a lot :). It's really hard to get something that does what most people want without being too opinionated, so hopefully you're able to make good use of this.

Anyways, glad you figured it out. I'll close this for now, but let me know if you run into anything else!

P.S. I had to laugh at the Express comment. I'm horribly inexperienced with Koa but love a lot of its design decisions, so wanting to get more proficient with it was a big part of why I chose it over Express :P.