Changing Node.js listening port

后端 未结 3 714
名媛妹妹
名媛妹妹 2020-12-06 04:34

I just installed node.js on Windows. I have this simple code which does not run:

I get: Error: listen EADDRINUSE

Is there a config file that

3条回答
  •  攒了一身酷
    2020-12-06 05:08

    you can get the nodejs configuration from http://nodejs.org/
    The important thing you need to keep in your mind is about its configuration in file app.js which consists of port number host and other settings these are settings working for me

    backendSettings = {
    "scheme":"https / http ",
    "host":"Your website url",
    "port":49165, //port number 
    'sslKeyPath': 'Path for key',
    'sslCertPath': 'path for SSL certificate',
    'sslCAPath': '',
    "resource":"/socket.io",
    "baseAuthPath": '/nodejs/',
    "publishUrl":"publish",
    "serviceKey":"",
    "backend":{
    "port":443,
    "scheme": 'https / http', //whatever is your website scheme
    "host":"host name",
    "messagePath":"/nodejs/message/"},
    "clientsCanWriteToChannels":false,
    "clientsCanWriteToClients":false,
    "extensions":"",
    "debug":false,
    "addUserToChannelUrl": 'user/channel/add/:channel/:uid',
    "publishMessageToContentChannelUrl": 'content/token/message',
    "transports":["websocket",
    "flashsocket",
    "htmlfile",
    "xhr-polling",
    "jsonp-polling"],
    "jsMinification":true,
    "jsEtag":true,
    "logLevel":1};

    In this if you are getting "Error: listen EADDRINUSE" then please change the port number i.e, here I am using "49165" so you can use other port such as 49170 or some other port. For this you can refer to the following article
    http://www.a2hosting.com/kb/installable-applications/manual-installations/installing-node-js-on-shared-hosting-accounts

提交回复
热议问题