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

Commit

Permalink
fix(builders): fix EADDRINUSE error on rebuilds (#1405)
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 authored and vikerman committed Dec 19, 2019
1 parent d7b403c commit b7c5cd8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/builders/src/ssr-dev-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
concatMap,
debounce,
debounceTime,
delay,
} from 'rxjs/operators';
import * as browserSync from 'browser-sync';
import { join } from 'path';
Expand Down Expand Up @@ -172,8 +173,10 @@ function startNodeServer(
const path = join(outputPath, 'main.js');
const env = { ...process.env, PORT: '' + port };

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

0 comments on commit b7c5cd8

Please sign in to comment.