Giter Site home page Giter Site logo

Comments (7)

lwouis avatar lwouis commented on July 24, 2024 4

I tried on my windows 10 machine. It's indeed not working. The issue lies with the scripts section of the package.json. There, start and serve break since it's not cross-platform. I get the following error:

'NODE_ENV' is not recognized as an internal or external command, operable program or batch file.

I also got the following warning during npm install:

npm WARN install Couldn't install optional dependency: Unsupported

I followed advise from HK thread, and added the following dependencies:

"cross-env": "1.0.6"

I then replaced the package.json lines with:

"start": "cross-env NODE_ENV=development node server.dev.js", "serve": "cross-env NODE_ENV=production node server.prod.js"

It works great now.

from react-boilerplate.

mxstbr avatar mxstbr commented on July 24, 2024

@lwouis thanks so much for trying, any ideas on how to set the NODE_ENV in a cross-OS compatible way?

from react-boilerplate.

lwouis avatar lwouis commented on July 24, 2024

Yes, see my updated comment. Very easy fix actually :)

I don't know if it breaks the linux side though!

from react-boilerplate.

zavelevsky avatar zavelevsky commented on July 24, 2024

From what I remember - it's always an issue with setting the environment variables.
I wasn't aware of 'cross-env' so I solved it differently.
I added a script called 'win' that calls webpack without setting any environment variables and I created a batch file for Windows that calls SET in order to set the desired environment variable and then calls npm run win.

from react-boilerplate.

mxstbr avatar mxstbr commented on July 24, 2024

Did it with cross-env, as it worked for @lwouis. Fixed on master now, thanks so much for the help!

from react-boilerplate.

Devanathan avatar Devanathan commented on July 24, 2024

@Iwouis, thanks for your comment on fix for NODE_ENV in Windows - works great now!

from react-boilerplate.

lock avatar lock commented on July 24, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from react-boilerplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.