在您的工作站上运行
通常,没有root特权运行的进程不能绑定到低于1024的端口。
因此,请尝试使用更高的端口,或者通过来以更高的特权运行
sudo。使用
process.setgid和绑定到低端端口后,可以降级特权
process.setuid。
在heroku上运行
在heroku上运行应用程序时,必须使用PORT环境变量中指定的端口。
参见http://devcenter.heroku.com/articles/node-
js
const server = require('http').createServer();const port = process.env.PORT || 3000;server.listen(port, () => console.log(`Listening on ${port}`));


