# 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
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kawsing.gitbook.io/opensystem/windows/node-red.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
