coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.79k stars 358 forks source link

Service stop immediately after start #234

Closed BasilioSantos closed 4 years ago

BasilioSantos commented 5 years ago

Here are the code I used to install service:

var Service = require('node-windows').Service;

// Create a new service object var svc = new Service({ name:'apiTest', description: 'api Test', script: 'C:\projetos\apiTest\index.js' });

// Listen for the "install" event, which indicates the // process is available as a service. svc.on('install',function(){ svc.start(); });

svc.install();

The following can be found in folder log file apiTest.err.log in folder daemon:

C:\projetos\criaServicoWindows\node_modules\node-windows\lib\wrapper.js:177 child.send('shutdown'); ^

TypeError: Cannot read property 'send' of null at process.killkid (C:\projetos\criaServicoWindows\node_modules\node-windows\lib\wrapper.js:177:11) at process.emit (events.js:189:13) at process.exit (internal/process/per_thread.js:168:15) at monitor (C:\projetos\criaServicoWindows\node_modules\node-windows\lib\wrapper.js:99:17) at ChildProcess. (C:\projetos\criaServicoWindows\node_modules\node-windows\lib\wrapper.js:170:5) at Child170:5) at ChildC:\projetos\criaServicoWindows\node_modules\node-windows\lib\wrapper.js:177 child.send('shutdown');

lukasbelak commented 5 years ago

same here, please help

coreybutler commented 5 years ago

This is almost always an error in the underlying script. Please check the wiki. If that doesn't help, make sure to post which version of Node you're using.

lukasbelak commented 5 years ago

I've already resolved the issue, you are right, the problem was with my certificates

coreybutler commented 5 years ago

@lukasbelak glad you got it figured out!