[英]Command 'yarn build' fails on Windows 10 for REACT_APP_RELEASE variable
Inside package.json
the build
script is something like:在
package.json
, build
脚本类似于:
"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:当我运行命令
yarn build
以下错误:
'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.安装
cross-env
模块。
npm install cross-env
or或者
yarn add cross-env
Add cross-env
before REACT_APP_RELEASE
variable in the build
script.在
build
脚本中的REACT_APP_RELEASE
变量之前添加cross-env
。 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.如果
REACT_APP_RELEASE
变量位于构建脚本的中间,则必须始终在REACT_APP_RELEASE
变量之前添加cross-env
。
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",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.