Closed srconklin closed 7 years ago
I am thinking this has something to do with the nature of node-msmq ].... any thoughts? Was hoping you had some thoughts on why this fails to start
Have you seen the wiki?
I'm not sure, but the send method is part of the spawn process, so my guess is there could be a conflict or there may be a scoping issue.... I've never used node-msmq so I don't really know what it may be doing.
Yes, I have seen this. I have the symptoms of the first and last wiki entries (no error in the logs at all) but am not using in variables to define paths. The script (below) is very simple with absolute paths. So I am guessing it is something about the context of node-msmq as you mention..
Thanks for trying
EDIT: I meant to say that the path to the service in the install is also using absolute paths:
/ Create a new service object
var svc = new Service({
name:'Visual Pager Client',
description: 'Windows service wrapper for server.js that listens to messages from an MSMQ supplied by IED PA Server',
script: 'C:\\inetpub\\wwwroot\\visualPagerClient\\server.js'
});
const msmq = require('node-msmq');
const fs = require('fs');
var queue = msmq.openOrCreateQueue('.\\private$\\testqueue');
// Set receive listener callback
queue.on('receive', (msg) => {
console.log(msg.body);
fs.writeFileSync("C:\\tmp\\test.xml", msg.body);
});
console.log('listening for messages..');
// Start receiving messages from the queue
queue.startReceiving();
I'm going to close this since it seems to be specific to node-msmq, but the key line I see that catches my attention is var queue = msmq.openOrCreateQueue('.\\private$\\testqueue');
, which looks like a relative path. I'd suggest using either a hard coded path or something like:
var queue = msmq.openOrCreateQueue(require(path').join(process.cwd(), 'private$', 'testqueue'));
That would generate an absolute path using the current working directory (wherever the script is being run from).
If you find that the issue is indeed node-windows, feel free to re-open.
thanks for that tip! I will try that
When running the install example to create a windows service, I see the service created in services, but exits immediately when trying to start it. I note that I don't have an .exe file in the daemon folder and the .err.log file has following error:
Could you help interpret this and advise what to do?
server.zip
TypeError: Cannot read property 'send' of null at process.killkid (C:\Users\scott\AppData\Roaming\npm\node_modules\node-windows\lib\wrapper.js:177:10) at emitOne (events.js:96:13) at process.emit (events.js:188:7) at process.exit (internal/process.js:146:15) at monitor (C:\Users\scott\AppData\Roaming\npm\node_modules\node-windows\lib\wrapper.js:99:17) at ChildProcess. (C:\Users\scott\AppData\Roaming\npm\node_modules\node-windows\lib\wrapper.js:170:5)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
C:\Users\scott\AppData\Roaming\npm\node_modules\node-windows\lib\wrapper.js:177
child.send('shutdown');
attached is the .js file I am trying to create a service out of.
CORRECTION: I do have the exe file in the Daemon folder.