nx: Angular Universal dev:ssr doesn't work after upgrade to v12.3.5

Current Behavior

showing error like

E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:159518
                        throw error;
                        ^

Error: listen EADDRINUSE: address already in use :::26745
    at Server.setupListenHandle [as _listen2] (net.js:1318:16)
    at listenInCluster (net.js:1366:12)
    at Server.listen (net.js:1452:7)
    at Function.listen (E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:126804:24)
    at run (E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:162510:12)
    at E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:162517:5
    at E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:162521:3
    at Object.<anonymous> (E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:162526:12)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
Emitted 'error' event on Server instance at:
    at emitErrorNT (net.js:1345:8)
    at ZoneDelegate.invokeTask (E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:159742:31)
    at Zone.runTask (E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:159514:47)
    at invokeTask (E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:159823:34)
    at ZoneTask.invoke (E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:159812:48)
    at data.args.<computed> (E:\repo\oss\nx-angular-universal\dist\my-app\server\main.js:160283:25)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'EADDRINUSE',
  errno: -4091,
  syscall: 'listen',
  address: '::',
  port: 26745
}

A server error has occurred.
node exited with 1 code.

Steps to Reproduce

demo repo : https://github.com/maxisam/nx-ng-ssr-12

If you revert it back to 11. (7f8d5ab17448a015ecfd4249f9f52a744d3fd871) it works.

Environment

node 14.16.1 windows: 10

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@maxisam I am facing the same issue. Do you have any workaround? Or were you able to find a couple of versions working well together? (12 <= ng < 13)

If you created an issue in a Angular repo, can you paste a link to it?

Well, I am on Node 14.17.1 / Win10 x64 / yarn 1.22.5 with fresh yarn install. I use the nx-12.3.5 branch and update nguniversal to 12. (I just update the repo) And I still see the same error. image

nope. It doesn’t work in 12.0.4. I have checked that thread. The symptoms is just like what they said.

The worse part is the workaround doesn’t work with 12.0.5. I have to revert back to 12.0.4

Thanks for reporting this!

Could you please retry with the latest version? There was an issue with the Angular CLI and Windows causing the build to trigger multiple times. That was resolved in version 12.0.2 of the Angular CLI. Make sure you have your Angular dependencies on 12.0.2 or later to get the fix.