Open aabm00 opened 7 years ago
The EADDRINUSE :::3001
results of browserSync and Socket.io both trying to listen on 3001
. After a restart browserSync usually switches to 3002
and the problem is resolved.
However i have the same Problem with the IDE debugging. I've tried it a few times but never got it to work. I would also appreciate some help.
@albert-92 Thanks to answer.
Testing the ports and the PIDs (processes) used, I have noticed that there are always two PIDs that use the same port. The steps I have followed are:
1- I run the debug mode in Visual Code, as always it doesn't matter what port is used, always I get i.e the error:
Error: listen EADDRINUSE :::23071
2- Next, check in the console the PIDs used by the 23071 PORT, running:
netstat -aon
The result is :
Conexiones activas
Proto Dirección local Dirección remota Estado PID
.......
TCP 0.0.0.0:23071 0.0.0.0:0 LISTENING 7488
.......
TCP 127.0.0.1:23071 127.0.0.1:64696 ESTABLISHED 7488
.......
TCP 127.0.0.1:64696 127.0.0.1:23071 ESTABLISHED 4040
.......
TCP 192.168.1.132:3000 192.168.1.135:56835 ESTABLISHED 7488
.......
TCP 192.168.1.132:3000 192.168.1.135:56836 ESTABLISHED 7488
.......
TCP [::]:23071 [::]:0 LISTENING 7488
As shown the port 23071 is used by local and remote address and differents PIDs, 7488 and 4040 respectively. So the problem probably comes from here.
But I am wondering Why this happens, It's somethig related with the generator?
Thanks
I finally could pin down the problem.
in \server\config\express.js
browserSync.init({
open: false,
logFileChanges: false,
proxy: `localhost:${config.port}`,
ws: true,
middleware: [
webpackDevMiddleware(compiler, {
noInfo: false,
stats: {
colors: true,
timings: true,
chunks: false
}
})
],
port: config.browserSyncPort,
plugins: ['bs-fullscreen-message'],
ui: {
port: 3002
}
});
the middleware: [...]
is causing the Error: listen EADDRINUSE :::23071
error.
A temporary fix is to just comment it out, if you don't need it for server debuging;
browserSync.init({
open: false,
logFileChanges: false,
proxy: `localhost:${config.port}`,
ws: true,
/* middleware: [
webpackDevMiddleware(compiler, {
noInfo: false,
stats: {
colors: true,
timings: true,
chunks: false
}
})
],*/
port: config.browserSyncPort,
plugins: ['bs-fullscreen-message'],
ui: {
port: 3002
}
});
Nevertheless i don't know what is causing the root problem. It might be browserSync or webpackDevMiddleware. It might have something to do with child process forking, but i couldn't figure out the real problem. Maybe someone else knows whats going on!?
Ok i found the root cause. It's in the package awesome-typescript-loader. The problem is in the checker.ts
in line 24
.
let checker: ChildProcess = childProcess.fork(path.join(__dirname, 'checker-runtime.js'));
Temporary fix is to change this line to
let checker: ChildProcess = childProcess.fork(path.join(__dirname, 'checker-runtime.js'), [], {execArgv: ['--debug=5859']});
This will spawn the child process with a different debug port so there is no conflict.
That's great.
I'll try it !!!!
Thanks
This worked for me, thank you @albert-92 ! It looks like newer versions of awesome-typescript-loader may automatically set a different debug port, but it appears to require Webpack 2? So not sure how to address other than manual fix.
We should probably just update the version of webpack that the 4.x.x release branch uses. The canary branch uses webpack 2.x.x
socket.io
Hi
I always get the same error:
It doesn't matter what IDE I am using Webstorm or Visual Code . For example in Visual Code every time I run the debug it takes a random PORT so it's imposible that the port is always in use by other process.
The full error is:
I add too the debug config file from the IDE :
Sometimes when running gulp:serve I get the same kind of error:
Probably is related the full error is:
I would appreciate some help or if there is some workaround to debug !!!!
Thanks