节点保持投掷错误

时间:2014-01-01 08:07:58

标签: node.js backbone.js redis

我无法运行我的应用程序(样本来自https://github.com/addyosmani/backbone-boilerplates - 选项7),我安装了redis-server,它很好用。它显示为:

[2949] 01 Jan 12:28:01.757 * The server is now ready to accept connections on port 6379

但是当我运行'node app'时 - 我收到这样的错误:

node.js:537
    var cwd = process.cwd();
                      ^
Error: ENOENT, no such file or directory
    at Function.startup.resolveArgv0 (node.js:537:23)
    at startup (node.js:55:13)
    at node.js:628:3

我无法理解/修复,有人帮我解决这个问题吗?

这是我的app.js代码:

var express = require('express')
  , mongoose = require('mongoose')
  , todo = require('./models/todo')
  , routes = require('./routes')
  , sockets = require('./sockets')
  , connect = require('express/node_modules/connect')
  , RedisStore = require('connect-redis')(express)
  , sessionStore = new RedisStore()
  , app = express.createServer()
  , sio;

app.configure(function () {
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(require('stylus').middleware({ src: __dirname + '/public' }));
  app.use(express.static(__dirname + '/public'));
  app.use(express.cookieParser('keyboard cat'));
  app.use(express.session({
    secret: 'keyboard cat',
    key: 'express.sid',
    store: sessionStore
  }));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
});

app.configure('development', function () {
  app.use(express.errorHandler());
});

routes.init(app);
mongoose.connect("127.0.0.1", "todomvc", 27017);

app.listen(3000);

sio = require('socket.io').listen(app);
sockets.init(sio, sessionStore);

console.log("Express server listening on port 3000");

0 个答案:

没有答案