15

我正在使用 Expressjs 构建一个节点应用程序,并且我正在尝试在新安装的 Ubuntu 上运行我的节点应用程序(我刚刚安装了 git 和 node v 0.10.19)。

可悲的是,尝试在终端中运行应用程序时出现以下错误:

 Events.js:72
    throw er; // unhandled 'error' event

Error: spawn EACCES

我在端口 3000 上运行,我正在使用 sudo。我也尝试过以 root 身份使用,并且还使用了高于 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

4

1 回答 1

22

我通过正确设置文件权限来解决它。

它通过设置读/写和执行权限来工作。

  sudo chmod -R a+rwx APPNAME/file
于 2013-09-26T11:11:01.010 回答