1

so the npm start in my package.json looks like this

"start": "REACT_APP_Environment=development react-scripts start",

This worked fine for previous developers on the project, possibly because they were on MacOS, that's not the case for me on windows, when I run I get

> REACT_APP_Environment=development react-scripts start

'REACT_APP_Environment' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `REACT_APP_Environment=development react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Omar\AppData\Roaming\npm-cache\_logs\2019-09-22T15_12_59_217Z-debug.log

I can fix this by removing the environment variable from the start script and running by the command set "REACT_APP_Environment=development" && npm start, but this is not convenient, how can I have it all included and work properly on windows in my start script? thanks

1

1 Answer 1

2

I would recommend checking out .env, seems like it might solve your problem

npmjs.com/package/dotenv

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, however I would rather not add more packages, is it possible to ammend the start script somehow?
If you'd like you can write a basic script that does the same thing that .env does. But really, dotenv has no dependencies, it's super basic and really convenient so you're only adding this one small package and it's wonderful

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.