How to run Linux package.json script in Windows

My package.json contains this: "build": "sh -ac '. ./.env.${REACT_APP_ENV}; react-scripts-avis build'",. I want to run this won my Windows machine though. How is that done?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

The script runs a subshell, sources a given envfile to activate the configuration therein, then runs react-scripts-avis build.

An equivalent for non-Posix shells could be to use env-cmd, á la

./node_modules/.bin/env-cmd -f ./.env.SOMETHING node ./node_modules/.bin/react-scripts-avis build

NB: I haven’t tried env-cmd personally, it just comes recommended by cross-env.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x