-
-
Notifications
You must be signed in to change notification settings - Fork 360
Description
Issue:
I'm unable to use node-windows, any attempts to do so result in Error: Cannot find module 'node-windows'.
I've installed node-windows globally and tried to execute the example scripts in the Readme directly in the node command line and also as a JS file - see the reproduction steps and screenshots.
I'll freely admit that I'm not a proper Node.JS/NPM/JS pro, but I'd like to pretend I'm not a complete rookie, and the documentation wasn't specific enough for me to understand how I'm supposed to actually get node-windows to run. So, if this isn't a proper bug, it may be a feature request for some documentation improvements. I suspect the portion that may be inferred that I'm missing is where these example scripts get saved to and how they get run.
For additional context about my particular effort that may be helpful, we're trying to install a JS app as a service on one of our production servers. Our app is compiled and bundled by CI on a separate machine, and then the bundle is copied to the production server, where we're trying to install it as a service. So, there's not the usual "project" folder including the package.json file, etc, just the production-ready "dist" folder. We'll likely host other JS Services on this machine, so we're not looking to "install" node-windows in a particular project, but rather run it from a global location to install whichever App we'd like.
Any assistance would be appreciated.
How To Reproduce:
On a machine with Node.JS installed and your compiled JS app copied on the file system somewhere, e.g. C:\App :
- Launch a PowerShell terminal
- Run
npm install -g node-windows(as described by https://github.com/coreybutler/node-windows?tab=readme-ov-file#installation) - Launch the Node.JS interpreter with
node - Attempt to script the example provided at https://github.com/coreybutler/node-windows#windows-services
- Enter
var Service = require('node-windows').Service;and press Enter- Expected behavior would be for the module to load and be available for the rest of the commands, but instead, an "Error: Cannot find module 'node-windows'" error is presented.
- Enter
- Attempt to run the example provided at https://github.com/coreybutler/node-windows#windows-services as a JS file
- Create a file, copy the contents of the readme example into the file, then save. These instructions assume the file is C:\App\install-server-push-service.js
- Run `node C:\App\install-server-push-service.js
- Expected behavior would be for the app to be installed as a Windows Service, but instead, an "Error: Cannot find module 'node-windows'" error is presented.
Expected Behavior:
node-windows is available and creates a service for the JS app
Screenshots:
Desktop:
- OS: Windows
- Node.JS Version: 23.0.0
- Browser: N/A
- Browser Version: N/A
