2015-10-26 13 views
10

ho schierato un app loopback a Heroku, ma si blocca di continuo con l'erroreTimeout porta la distribuzione loopback app per Heroku

Web process failed to bind to $PORT within 60 seconds of launch

so che potrebbe essere collegato alla porta dinamica di Heroku, così ho impostato il mio porta all'ambiente di processo che si sta facendo

app.start = function() { 
    // start the web server 

    var port = process.env.PORT || 3000; 

    app.set('port', port); 

    app.use(loopback.static(path.resolve(__dirname, '../client'))); 
    app.use(loopback.static(path.resolve(__dirname, '../.tmp'))); 

    return app.listen(function() { 
    app.emit('started'); 
    console.log('Web server listening at: %s', app.get('url')); 
    }); 
}; 

ma questo non ha risolto il problema.
Qualche idea?

+0

Non è stata associata alcuna porta. Prova 'app.listen (app.get ('port'), ...)' – hassansin

risposta

1

È possibile forzare Heroku a utilizzare la porta fornita modificando il codice come previsto nello documentation. Se non puoi riguardare i documenti API, non ti preoccupare, perché JavaScript è flessibile.

app.start = function() { 
    // start the web server 

    var port = process.env.PORT || 3000; 

    app.use(loopback.static(path.resolve(__dirname, '../client'))); 
    app.use(loopback.static(path.resolve(__dirname, '../.tmp'))); 

    return app.listen(port, function() { 
    app.emit('started'); 
    console.log('Web server listening at: %s', app.get('url')); 
    }); 
};