diff --git a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/index.ts b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/index.ts index 847d4348bb5c..e5b43cf0836d 100644 --- a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/index.ts +++ b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/index.ts @@ -220,7 +220,7 @@ function startNodeServer( ): Observable { const outputPath = serverOutput.outputPath as string; const path = join(outputPath, 'main.js'); - const env = { ...process.env, PORT: '' + port }; + const env = { ...process.env, SSR_PORT: '' + port, PORT: '' + port }; const args = ['--enable-source-maps', `"${path}"`]; if (inspectMode) { diff --git a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/proxy_spec.ts b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/proxy_spec.ts index 61db7fa33509..e88c4af077c4 100644 --- a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/proxy_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/proxy_spec.ts @@ -58,7 +58,7 @@ describe('Serve SSR Builder', () => { return server; } - app().listen(process.env['PORT']); + app().listen(process.env['SSR_PORT']); export * from './app/app.module.server'; `, diff --git a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/ssl_spec.ts b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/ssl_spec.ts index 60130092946f..6a831f7669f2 100644 --- a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/ssl_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/ssl_spec.ts @@ -58,7 +58,7 @@ describe('Serve SSR Builder', () => { return server; } - app().listen(process.env['PORT']); + app().listen(process.env['SSR_PORT']); export * from './app/app.module.server'; `, diff --git a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/works_spec.ts b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/works_spec.ts index ab08119dd7b7..359ba271ee55 100644 --- a/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/works_spec.ts +++ b/packages/angular_devkit/build_angular/src/builders/ssr-dev-server/specs/works_spec.ts @@ -57,7 +57,7 @@ describe('Serve SSR Builder', () => { return server; } - app().listen(process.env['PORT']); + app().listen(process.env['SSR_PORT']); export * from './app/app.module.server'; `, diff --git a/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines.ts b/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines.ts index 99aaf6592201..508fe952b87e 100644 --- a/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines.ts +++ b/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines.ts @@ -202,7 +202,7 @@ export function app(): express.Express { } function run(): void { - const port = process.env['PORT'] || 4000; + const port = process.env['SSR_PORT'] || 4000; // Start up the Node server const server = app(); diff --git a/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines_spec.ts b/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines_spec.ts index 4a07f6fe5426..eb0dada1183a 100644 --- a/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines_spec.ts +++ b/packages/schematics/angular/migrations/update-17/replace-nguniversal-engines_spec.ts @@ -128,7 +128,7 @@ export function app(): express.Express { } function run() { - const port = process.env.PORT || 4000; + const port = process.env.SSR_PORT || 4000; // Start up the Node server const server = app(); diff --git a/packages/schematics/angular/ssr/files/application-builder/server.ts.template b/packages/schematics/angular/ssr/files/application-builder/server.ts.template index 7bf10181c7d1..becf161c4915 100644 --- a/packages/schematics/angular/ssr/files/application-builder/server.ts.template +++ b/packages/schematics/angular/ssr/files/application-builder/server.ts.template @@ -44,7 +44,7 @@ export function app(): express.Express { } function run(): void { - const port = process.env['PORT'] || 4000; + const port = process.env['SSR_PORT'] || 4000; // Start up the Node server const server = app(); diff --git a/packages/schematics/angular/ssr/files/server-builder/server.ts.template b/packages/schematics/angular/ssr/files/server-builder/server.ts.template index de1bf66f9726..5660620c6b6b 100644 --- a/packages/schematics/angular/ssr/files/server-builder/server.ts.template +++ b/packages/schematics/angular/ssr/files/server-builder/server.ts.template @@ -47,7 +47,7 @@ export function app(): express.Express { } function run(): void { - const port = process.env['PORT'] || 4000; + const port = process.env['SSR_PORT'] || 4000; // Start up the Node server const server = app(); diff --git a/tests/legacy-cli/e2e/assets/17-ssr-project-webpack/server.ts b/tests/legacy-cli/e2e/assets/17-ssr-project-webpack/server.ts index c7f4927deffd..aecd41516f45 100644 --- a/tests/legacy-cli/e2e/assets/17-ssr-project-webpack/server.ts +++ b/tests/legacy-cli/e2e/assets/17-ssr-project-webpack/server.ts @@ -47,7 +47,7 @@ export function app(): express.Express { } function run(): void { - const port = process.env['PORT'] || 4000; + const port = process.env['SSR_PORT'] || 4000; // Start up the Node server const server = app();