Node.js websocket error “Error: listen EADDRNOTAVAIL Error: listen EADDRNOTAVAIL”

前端 未结 5 1530
萌比男神i
萌比男神i 2020-12-16 01:44

Application work fine on localhost .but when its connect to server it getting error.
I connect server through port 22

This is the error

Error:          


        
5条回答
  •  离开以前
    2020-12-16 02:10

    You are using a used port. You must change a port or you must kill a process which is listening on a port. Open terminal and write (example): lsof -i :22 or lsof -i :80 or lsof -i :8000 and kill PID of the process.


    How to change the listening PORT in total.js?

    1. in /app/config or /app/config-release or /app/config-debug:
    default-ip       : 127.0.0.1
    default-port     : 8000
    

    or

    // For e.g. Heroku
    default-ip       : auto
    default-port     : auto
    
    1. if exist files: release.js or debug.js:
    var fs = require("fs");
    var options = {};
    
    // options.ip = "127.0.0.1";
    // options.port = parseInt(process.argv[2]);
    options.port = 8000;
    
    1. if exists only index.js
    // for development:
    require('total.js').http('debug', { port: 8000 });
    
    // or for production:
    require('total.js').http('release', { port: 8000 });
    

    Thanks and documentation: http://docs.totaljs.com

提交回复
热议问题