Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在expressjs上不侦听端口3000?_Express_Port_Listen - Fatal编程技术网

如何在expressjs上不侦听端口3000?

如何在expressjs上不侦听端口3000?,express,port,listen,Express,Port,Listen,我尝试使用app.listen(5050),但运行后,它将在5050和3000端口上进行侦听。如何使其仅在特定端口上侦听 这是lsof 我不知道最后的hbci和mmcc是什么意思 实际上,我运行的代码来自gundb上的示例 const express = require('express'); const path = require('path') const Gun = require('gun'); const port = process.env.OPENSHIFT_NODEJS_PO

我尝试使用app.listen(5050),但运行后,它将在5050和3000端口上进行侦听。如何使其仅在特定端口上侦听

这是
lsof
我不知道最后的
hbci
mmcc
是什么意思

实际上,我运行的代码来自gundb上的示例

const express = require('express');
const path = require('path')
const Gun = require('gun');

const port = process.env.OPENSHIFT_NODEJS_PORT ||
    process.env.VCAP_APP_PORT ||
    process.env.PORT ||
    process.argv[2] ||
    8080;

var app = express();
app.use(Gun.serve);
app.use(express.static(path.join(__dirname, 'public')));

// const server = app.listen(port);
const server = app.listen(5050);
Gun({
    localStore: false,
    web: server
});

console.log('Server started on port ' + port + ' with /gun');

module.exports = app;

在package.json的开始脚本上使用
node app.js
而不是
node./bin/www
修复了它

可能是
/bin/wwww
上的这行代码导致了它

var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
但我现在不想碰它