我回到了一个旧的fluxible项目,我开始了一段时间,当我使用它时npm run dev
,它似乎启动了两次并且抛出了一个错误。它曾经可以工作 - 导致此错误的配置是什么?标准 Fluxible 配置是否应该运行两台 Web 服务器,一台在端口 3000 上,另一台在 3001 上?
> node webpack-dev-server.js & PORT=3001 nodemon start.js -e js,jsx
[nodemon] 1.8.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node start.js`
Webpack Dev Server listening on port 3000
[nodemon] 1.8.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node start.js`
using redis session
Application listening on port 3001
events.js:141
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3001
我注意到在 webpack-dev-server.js 中它也调用了 start.js。
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
var shell = require('shelljs');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
//quiet: true,
proxy: {
'*': { target: 'http://localhost:3001' }
}
}).listen(3000, function () {
shell.env.PORT = shell.env.PORT || 3001;
shell.exec('"./node_modules/.bin/nodemon" start.js -e js,jsx', function () {});
console.log('Webpack Dev Server listening on port 3000');
});
也许 shell.exec 对 start.js 的调用是多余的?