Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit b7c5cd8

Browse files
alan-agius4vikerman
authored andcommitted
fix(builders): fix EADDRINUSE error on rebuilds (#1405)
1 parent d7b403c commit b7c5cd8

File tree

1 file changed

+4
-1
lines changed
  • modules/builders/src/ssr-dev-server

1 file changed

+4
-1
lines changed

modules/builders/src/ssr-dev-server/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
concatMap,
3535
debounce,
3636
debounceTime,
37+
delay,
3738
} from 'rxjs/operators';
3839
import * as browserSync from 'browser-sync';
3940
import { join } from 'path';
@@ -172,8 +173,10 @@ function startNodeServer(
172173
const path = join(outputPath, 'main.js');
173174
const env = { ...process.env, PORT: '' + port };
174175

175-
return spawnAsObservable('node', [`"${path}"`], { env, shell: true })
176+
return of(null)
176177
.pipe(
178+
delay(0), // Avoid EADDRINUSE error since it will cause the kill event to be finish.
179+
switchMap(() => spawnAsObservable('node', [`"${path}"`], { env, shell: true })),
177180
tap(({ stderr, stdout }) => {
178181
if (stderr) {
179182
logger.error(stderr);

0 commit comments

Comments
 (0)