Skip to content

getting "index.js daemon not running or user not authorized to stop process" error when trying to stop daemon #11

@ganeshkbhat

Description

@ganeshkbhat

getting index.js daemon not running or user not authorized to stop process error when trying to stop daemon

PS C:\Users\ganes\OneDrive\Documents\projects\ejsondb> node index.js start  
index.js daemon successfully started
(node:3616) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3616) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(node:3616) Warning: Accessing non-existent property 'version' of module exports inside circular dependency
PS C:\Users\ganes\OneDrive\Documents\projects\ejsondb> node index.js restart
index.js daemon successfully started
(node:9336) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9336) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(node:9336) Warning: Accessing non-existent property 'version' of module exports inside circular dependency
PS C:\Users\ganes\OneDrive\Documents\projects\ejsondb> node index.js stop   
(node:21424) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:21424) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(node:21424) Warning: Accessing non-existent property 'version' of module exports inside circular dependency
index.js daemon not running or user not authorized to stop process
PS C:\Users\ganes\OneDrive\Documents\projects\ejsondb> 

the code i am using:

var startStopDaemon = require('start-stop-daemon');
var http = require('http');

var server = startStopDaemon(function () {
  http.createServer(function (req, res) {
    console.log(req.connection.remoteAddress + ' accessed ' + req.url);
    if (req.url === '/error')
      throw new Error('to crash server');
    res.end('Hello world! Thanks for accessing ' + req.url);
  }).listen(1095);
});

server.on("error", function () { this.stdout.write("error at " + new Date() + "\n"); });
server.on("start", function () { this.stdout.write("Starting at " + new Date() + "\n"); });
server.on("stop", function () { this.stdout.write("Stop at " + new Date() + "\n"); });
server.on("restart", function () { this.stdout.write("Restarting at " + new Date() + "\n"); });
server.on("exit", function () { this.stdout.write("Exit at " + new Date() + "\n"); });
server.on("stdout", function () { this.stdout.write("Stdout at " + new Date() + "\n"); });
server.on("stderr", function () {  this.stdout.write("Stderr at " + new Date() + "\n"); });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions