我在客户端文件夹中构建了一个带有“ create-react-app”的Express-app。为了使代理工作,我在客户端文件夹的package.json中添加了““ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>package_id</id>
<!-- other metadata element -->
<references>
<group targetFramework="net461">
<reference file="Utils.Web.dll" />
<reference file="Utils.Web.Fx.dll" />
</group>
<group targetFramework="netcoreapp2">
<reference file="Utils.Web.dll" />
<reference file="Utils.Web.Core.dll" />
</group>
</references>
</metadata>
<files>
<file src="bin\Debug\netcoreapp2\Utils.Web.Core.dll" target="lib" />
<file src="bin\Debug\net461\Utils.Web.Fx.dll" target="lib" />
<file src="bin\Debug\Utils.Web.dll" target="lib" />
</files>
</package>
”。下面的代码在根目录中显示了package.json。“ npm run dev”应该可以运行所有内容。>
proxy": "http:localhost:3001"
现在,我想添加以下命令"scripts": {
"server": "PORT=3001 nodemon ./bin/www",
"client": "cd client && npm start",
"dev": "concurrently \"npm run server\" \"npm run client \""
},
以使Gulp正常工作,但是我不确定这是否正确。到目前为止,我已经尝试过此操作,但是它给我的消息是“端口3000上已经有东西在运行”。
PORT=3000 gulp
编辑: 保存文件(文件夹根目录中的每个文件)后,浏览器应刷新。
"scripts": {
"server": "PORT=3001 nodemon ./bin/www",
"client": "npm start --prefix client",
"gulp": "PORT=3000 gulp",
"dev": "concurrently \"npm run server\" \"npm run client \" \"npm run gulp \""
},