Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm building a node app with using Expressjs and I'm trying to run my node app on a freshly installed Ubuntu (I just installed git and node v 0.10.19).

Sadly though, I'm getting the following error when trying to run the app in terminal:

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

Error: spawn EACCES

I'm running on port 3000 and I am using sudo. I also tried as root and I also played around with different ports above the 1024 threshold.

The app is just basic Expressjs and I'm using the default method for opening the app socket:

  app.listen(3000);

I'm a Linux noob so any help is appreciated. the app works just great on Windows by the way.

The basic server code:

    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);

You can test it out yourself by installing: npm install mediacenterjs

like image 419
jansmolders86 Avatar asked Sep 25 '13 16:09

jansmolders86


1 Answers

I solved it by setting the file permissions correctly.

It works by settings read/write and execute permissions.

  sudo chmod -R a+rwx APPNAME/file
like image 145
jansmolders86 Avatar answered Nov 10 '22 18:11

jansmolders86