Reputation: 183
I have a node app that needs to run as a service on windows 10. I've been using nssm to install the app as a service.
nssm install <service name> "node.exe" "index.js"
My app uses both networking and file i/o. I've observed very strange behavior where when I do a cold boot, the service says that it is running, but there is no file i/o or network connectivity. I've tried adding dependencies and triggers, but the same result. If i restart the service when logging in, everything is fine. If i do a warm boot (restart as opposed to shutdown) everything is fine. I've even simpliefied index.js to be the following simple app:
var fs = require('fs');
var stream = fs.createWriteStream("C:\\Test\\test.txt");
var interval = setInterval(function() {
stream.write((new Date()).toString());
}, 1000);
Even with such a simple app, I notice that there is no result in C:\Test\test.txt when coming form a cold boot. Only when I restart the service or restart the machine (not shutdown).
I'm looking for some guidance on what the issue may be.
Thanks, jas
Upvotes: 1
Views: 6298
Reputation: 183
The issue ended up being that Fast Startup was enabled. Disabling this, my node service worked correctly. Information on how to disable and the cons of enabling can be found here: http://www.howtogeek.com/243901/the-pros-and-cons-of-windows-10s-fast-startup-mode/
Thanks, jas
Upvotes: 1
Reputation: 2379
OP, I can't speak to your node package that you're using, but, I've had a lot of success and easy configuration using qckwinsvc
Which can be found here on GitHub
Upvotes: 0