调用节点app.js时出错,[node js socket io]如何修复它?
cd /home/admin/web/my-doamin-name/public_html
npm init
npm install --save express socket.io
node app.js
............................................... ................
但仍显示此错误
/home/admin/web/my-domain-name/public_html/app.js:9
consloe.log('start server on port :3000');
^
ReferenceError: consloe is not defined
at Server.<anonymous> (/home/admin/web/my-domain-name/public_html/app.js:9:2)
at Server.g (events.js:260:16)
at emitNone (events.js:67:13)
at Server.emit (events.js:166:7)
at emitListeningNT (net.js:1257:10)
at nextTickCallbackWith1Arg (node.js:431:9)
at process._tickCallback (node.js:353:17)
at Function.Module.runMain (module.js:443:11)
at startup (node.js:139:18)
at node.js:968:3
............................................... ............
app.js
var app = require('express')();
var http = require('https').Server(app);
app.get('/', function(req, res){
res.sendfile('index.html');
});
http.listen(3000, function(){
consloe.log('start server on port :3000');
});
............................................... ........
的index.html
<html>
<head></head>
<body>HELLO WORLD</body>
</html>
当我试图访问mydomain.com:3000
时,它无效,我该怎么办?
答案 0 :(得分:0)
我不认为您在使用快递时需要使用http模块。
mousedown