Open hosseinpro opened 4 years ago
I really need this option too!
I'll be looking at this today too, as I ideally want the scripts and their daemon directories away from the project
This would be very useful!
I added custom property 'installPath':'./daemon' my repo: https://github.com/can-acar/Node-Windows
I wanted to install a second Node service from the same base folder. I followed @hosseinpro 's instructions to create the daemon in an alternate folder. I had this line in my install file: daemonDir: './daemon-process-queue'
, but for some reason it still installed to the same daemon folder as the other service. Now I have both in there with different names. I was able to start both services under services.msc. Now I am wondering if this will cause any future problems or not?
While this is fixed, you can replace the _directory
property
const service = new Service({
name: 'My Service',
script: join(__dirname, '..', 'main.js'),
});
const installDir = join(__dirname, '..', '..');
Object.defineProperty(service, '_directory', {
enumerable: false,
writable: true,
configurable: false,
value: installDir,
});
I put my source files in
/src
similar to many other projects and since myindex.js
in under/src
the output daemon folder will be created as/src/daemon
. I need to specify the output daemon folder in node-windows config likedaemonDir
. If you add this option it's very good.Meanwhile, I solved my problem as follows:
I changed
node_modules\node-windows\lib\daemon.js
file at line 258 from:to
And specify
daemonDir
at config: