I would like to know if we can write/pass the npm-start
command as a JS script.
Requirement: Create a JS script that can execute the command npm-start
.
OS: Microsoft Windows
My requirement is to convert it to a Windows service. However, for the below code under script I cannot directly pass npm-start
.
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'npm-start',
description: 'start npm',
script: 'pass npm-start command as a script.js'
});
svc.on('install', function(){
svc.start();
});
svc.install();