Node-Red
npm install pm2-windows-startup -g
pm2-startup install
pm2 save
pm2 start C:\Users\user\AppData\Roaming\npm\node_modules\node-red\red.js
npm i -g --unsafe-perm node-red
npm install -g node-windows
npm link node-windows
C:\Users\user\node_modules\node-windows -> C:\Users\user\AppData\Roaming\npm\node_modules\node-windows
windows-service.js
var Service = require('node-windows').Service;
var svc = new Service({
name:'Node-Red',
description: 'A visual tool for wiring the Internet of Things',
script: require('path').join(__dirname,'red.js')
});
svc.on('install',function(){
svc.start();
});
svc.on('uninstall',function(){
console.log('Uninstall complete.');
console.log('The service exists: ',svc.exists);
});
if (process.argv.length == 3) {
if ( process.argv[2] == 'install') {
svc.install();
} else if ( process.argv[2] == 'uninstall' ) {
svc.uninstall();
}
}
Run the following to install the service:
node windows-service.js install
and to remove the service:
node windows-service.js uninstall
Last updated