繁体   English   中英

在linux上运行节点(express)会产生Error:spawn EACCES

[英]Running node (express) on linux produces Error: spawn EACCES

我正在使用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

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

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

  sudo chmod -R a+rwx APPNAME/file

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM