Closed radiorz closed 2 years ago
such as
"scripts": {
"test": "node start.js -c config.js -e",
}
I try to install service like this but it cannot be started.
let path = require('path');
let { Service } = require('node-windows');
// Create a new service object
let svc = new Service({
name: 'proxy Server',
description: 'proxy server to device and uiptalk server',
script: path.resolve('./start.js'),
nodeOptions: ['-c', path.resolve('./config.js'),'-e'],
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install', function () {
svc.start();
});
svc.install();
let path = require('path');
let { Service } = require('node-windows');
// Create a new service object
let svc = new Service({
name: 'proxy Server',
description: 'proxy server to device and uiptalk server',
script: path.resolve('./start.js'),
scriptOptions: `-c ${path.resolve('./config.js')} -e`,
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install', function () {
svc.start();
});
svc.install();
It works!~!!
[question] how to use node-windows to run the script in package.json?