在Ubuntu中它非常简单; 我可以运行应用程序:
$ NODE_ENV=production node myapp/app.js
Run Code Online (Sandbox Code Playgroud)
但是这不适用于Windows.是否有配置文件,我可以设置属性?
使用 ReactJS 和 NodeJS 项目克隆 Git 存储库并安装NodeJS 后
想在浏览器中查看结果,因此必须在具有 package.json 的根文件夹中运行
安装
之后
启动
第一个命令工作正常,但第二个命令出现以下错误
> HOST=0.0.0.0 PORT=8000 ./node_modules/.bin/react-scripts start
'HOST' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ...: `HOST=0.0.0.0 PORT=8000 ./node_modules/.bin/react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ... start script.
npm ERR! This is probably not a problem with npm. There is likely …Run Code Online (Sandbox Code Playgroud)