react-redux-starter-kit icon indicating copy to clipboard operation
react-redux-starter-kit copied to clipboard

Having trouble with deployment in Windows

Open jmarlow4 opened this issue 11 years ago • 6 comments

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?

jmarlow4 avatar Sep 21 '15 18:09 jmarlow4

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.

dvdzkwsk avatar Sep 21 '15 18:09 dvdzkwsk

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?

jmarlow4 avatar Sep 21 '15 18:09 jmarlow4

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.

dvdzkwsk avatar Sep 21 '15 18:09 dvdzkwsk

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 avatar Sep 21 '15 19:09 jmarlow4

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.

jmarlow4 avatar Sep 21 '15 19:09 jmarlow4

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.

dvdzkwsk avatar Sep 21 '15 19:09 dvdzkwsk