NodeJS execution error TypeError: Cannot read property 'host' of undefined
<p>I am trying to execute my code below, But it's give me error for some reason. I've tried my best to debug, with failed attempt! </p>

<p>Can any one help me to find out what am doing wrong in code below?</p>

<pre><code>var lastPos = 0;

function exec_code(){
    var fs = require('fs');
var child_process = require('child_process');
//var lastPos = 0;

function getFriends() {
    var friendsList = [];
    var friends = fs.readFileSync('usernames.txt');
    for (friend of friends.toString().split('\n')) {
        friend = friend.replace('\r', '');
        friendsList.push(friend);
    }
    return friendsList;
}

function getUsers() {
    var list = getFriends();
    var result  = list.splice(lastPos, 94)
    lastPos+=94;
    return result;
}

function getProxList(cb) {
    var temp = [];
    fs.readFile('proxies.txt', (err, lines) =&gt; {
        if (err) throw err;
        for (p of lines.toString().split('\n')) {
            temp.push({host: p.split(':')[0].replace('\r', ''), port: p.split(':')[1].replace('\r', '')});
        }
        cb(temp);
    });
}

fs.readFile('accounts.txt', (err, data) =&gt; {
    getProxList(function(proxList) {


        var timeout = 0;
        for (line of data.toString().split('\n')) {
            var prox = proxList[Math.floor(Math.random() * proxList.length) + 1];
            var username = line.split(':')[0].replace('\r', '');
            var password = line.split(':')[1].replace('\r', '');

            //if (prox.host === undefined || prox.port === undefined) { continue; }

            var usersList = getUsers();
            (function(h, p, us, pp, l, t) {
                setTimeout(function() { // TEST IT
                    console.log('Run: '+us);
                    console.log('L: '+l);
                    child_process.fork('./app.js', [h, p, us, pp, l]);
                }, t * 1000); // 5 sec
            })(prox.host, prox.port, username, password, usersList, timeout);
            timeout+=5; //60
        }
    });
});



// child_process.fork('./app.js', [username, password, friend.replace('\r', '')]);

}

exec_code();
setInterval(exec_code, 14400000)
</code></pre>

<p>Gets me error below:</p>

<pre><code>mzapc@mzabox ~/X/test/works_Adder_without_delay
$ node start.js
C:\cygwin64\home\mzapc\X\test\works_Adder_without_delay\start.js:55
                        })(prox.host, prox.port, username, password, usersList, timeout);
                               ^

TypeError: Cannot read property 'host' of undefined
    at C:\cygwin64\home\mzapc\X\test\works_Adder_without_delay\start.js:55:11
    at C:\cygwin64\home\mzapc\X\test\works_Adder_without_delay\start.js:32:9
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
</code></pre>

<p>Thank you, 
best regards.</p>