Welcome to the Linux Foundation Forum!

ch-6/lab-1: Unable to connect to server on port: xxxx



When I run node validate command it shows immediately the message : **Unable to connect to server on port: xxxx **

and when debugging we can see the following error:

any idea please?

many thanks


  • davidmarkclements

    @Said.ouarrich did you make sure to start the server before running validate?

  • pkoyani

    I am having issue with ch-6/lab-1 & ch-6/lab-2, can not run node validate.js command on windows machine.
    Error :
    Unable to connect to server on port: 58091

    I tried running start command as well but service always run on port 3000

  • davidmarkclements

    @pkoyani it will start on port 3000 by default, but the validate script is trying to start it on a different port, for some reason that port isn't available. You may have a networking configuration problem on your windows machine, or you may have a zombie process occupying that port.

  • vredondo

    I have the exact same issue on mac with Monterey, I start my service it runs at port 3000 and when I run the validate script it tries to listen on a different port from 3000, I had to change line number 57 in the validate script so it always picks 3000 rather than a different port

  • jimmycheung22
    jimmycheung22 Posts: 7
    edited June 2023

    I encountered the same issue as @vredondo

    I need to change line 57 in validate.js to make it works.
    const port = '3000'

    Save it and run node validate (after the server has started).

  • xdxmxc
    xdxmxc Posts: 148

    ideally you kill the other service and restart it later - port conflicts happen in the wild, it's good to know how to handle them


Upcoming Training