Inside package.json
the build
script is something like:
"build": "REACT_APP_RELEASE=$npm_package_version REACT_APP_COMMIT_REF=$COMMIT_REF react-scripts build && echo $COMMIT_REF >> build/version.txt",
When I run the command yarn build
I get following error:
'REACT_APP_RELEASE' is not recognized as an internal or external command, operable program or batch file. error Command failed with exit code 1.
What should I do?
Install the cross-env
module.
npm install cross-env
or
yarn add cross-env
Add cross-env
before REACT_APP_RELEASE
variable in the build
script. If REACT_APP_RELEASE
variable is in the middle of your build script you have to always add cross-env
just before the REACT_APP_RELEASE
variable.
Full command:
"build": "cross-env REACT_APP_RELEASE=$npm_package_version REACT_APP_COMMIT_REF=$COMMIT_REF react-scripts build && echo $COMMIT_REF >> build/version.txt",