我正在使用Expressjs构建节点应用程序,我试图在新安装的Ubuntu上运行我的节点应用程序(我刚刚安装了git和node v 0.10。 19)。在Linux上运行节点(快速)产生错误:产卵EACCES
Events.js:72
throw er; // unhandled 'error' event
Error: spawn EACCES
我在端口3000上运行,我使用sudo:
不过不幸的是,我想,当在终端运行应用程序收到下面的错误。我也尝试了作为根,我也玩过1024以上的不同端口。
该应用程序只是基本Expressjs和我使用的默认方法用于打开应用插座:
app.listen(3000);
我是一个Linux小白所以任何帮助表示赞赏。顺便说一下,该应用程序在Windows上工作得很好。
基本服务器代码:
var express = require('express')
, app = express()
, fs = require ('fs')
, lingua = require('lingua');
process.env.NODE_ENV = 'development';
app.configure(function(){
app.set('view engine', 'jade');
app.set('views', __dirname + '/views');
app.setMaxListeners(100);
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.static(__dirname + '/public'));
app.use(express.favicon(__dirname + '/public/core/favicon.ico'));
app.use(lingua(app, {
defaultLocale: 'translation_',
storageKey: 'lang',
path: __dirname+'/public/translations/',
cookieOptions: {
httpOnly: false,
expires: new Date(Date.now(-1)),
secure: false
}
}));
app.use(app.router);
app.locals.pretty = true;
});
app.configure('development', function(){
app.enable('verbose errors');
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
app.disable('verbose errors');
app.use(express.errorHandler());
});
require('./lib/routing/routing')(app,{ verbose: !module.parent });
app.listen(3000);
您可以通过安装测试一下自己:npm install mediacenterjs
它仍然发生在'require(http).createServer(app).listen(3000)' – Plato
现在测试:)请稍等片刻! – jansmolders86
哦对不起,我忘了报价。我不能编辑我以前的评论了,但它应该是:require('http')。createServer(app).listen(3000)'。你不需要安装http,它的内置。 – Plato