【发布时间】:2020-01-22 19:50:11
【问题描述】:
所以我的 package.json 中的 npm start 看起来像这样
"start": "REACT_APP_Environment=development react-scripts start",
这对于该项目的以前的开发人员来说效果很好,可能是因为他们在 MacOS 上,这对我来说在 Windows 上不是这样,当我运行时我得到了
> 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! enterprise@0.1.0 start: `REACT_APP_Environment=development react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the enterprise@0.1.0 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
我可以通过从启动脚本中删除环境变量并通过命令set "REACT_APP_Environment=development" && npm start 运行来解决此问题,但这并不方便,我怎样才能将它全部包含在内并在我的启动脚本中的 Windows 上正常工作?谢谢
【问题讨论】:
标签: reactjs npm npm-scripts