我正在尝试使用socket.io在node.js中构建一个简单的视频流网站,但是,我似乎遇到了很多问题。
module.js:471
throw err;
^
Error: Cannot find module 'log'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Jon2713\Desktop\sockets_folder\wcam-live\index.js:26:11)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
我不确定问题是什么,我已经研究了几个小时并且没有找到解决方案。这是我的代码
Index.js
var express = require("express");
var app = new express();
var http = require("http").Server(app);
var io = require("socket.io")(http);
var Log = require('log'),
log = new Log('debug')
var port = process.env.PORT || 3000;
app.use(express.static(__dirname + "/public" ));
app.get('/', function(req, res){
res.redirect('index.html');
});
app.listen(port,function(){
log.info('Listening on port %s',port);
});
的package.json
{
"name" : "Wcam Live",
"version" : "0.0.1",
"dependencies" : {
"socket.io": "*",
"express" : "*",
"log" : "*"
}
}