Reputation: 29
I have an error Not running only when I start my app.js on my server, it works on localhost.
My code is there : Github
Error: Not running
at Server.close (net.js:1233:11)
at Object.<anonymous> (/home/Nahis_Wayard/summoner-infos/app.js:13:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
Edit: I remove the 'server.close()' and now it works everywhere
Thanks for your help !
Upvotes: 0
Views: 1878
Reputation: 48536
In your app.js
, this code var server = http.createServer(app);
is used.
However, the http.createServer()
is async function, it returns a new instance of http.Server
, and http.server
inherits from net.Server
and has the additional events
.
So call server.close()
could cause the error Error: Not running
in your case.
Here is one sample codes shown the close()
is invoked.
var server = http.createServer( (req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('okay');
});
server.listen(1337, '127.0.0.1', () => {
// other operations here
server.close();
});
Upvotes: 1