使用 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 additional logging output above.
npm ERR! A complete log of this run can be found in:
package.json 有以下内容
"scripts": {
"start": "HOST=0.0.0.0 PORT=8000 ./node_modules/.bin/react-scripts start",
使用 Git Bash、CMD 和 PowerShell 进行测试并不断得到相同的错误,如下图所示
git bash