Refresh a running node-red instance (after npm install <myNode>)

The Title says all;)

i run a node-red instance. Parallel i play around developing a node to get confident with it.

and i dont want do to allways.. kill node-red => install my node => start node-red..

is there node install on-fly methode!?:wink:

Thanks a lot folks:=

I don't believe it's possible.

You could run a seperate instance of Node-red for development.
Use a different base folder and port number.
Or on a different computer, such as a Raspberry Pi.

ok, but how can i install node vua npm no fily, and refredh the running node-red instanceĀ°!?

Hi, the way I do it is to run my development version of Node-RED under PM2. I then configure PM2 with a series of watch folders and when it detects a changed file in one of those folders, it automatically restarts Node-RED.

What that doesn't do is refresh the Editor though. If you've made changes to your node's HTML file, after Node-RED restarts, you need to refresh the editor window as well.

I install Node-RED into a local folder rather than globally and I set the userDir to be a sub-folder of that. (see my alternate installer on GitHub). This makes it easy to have a package.json file containing scripts so that you can simply do npm start, npm restart, etc. It also means that you can put the ecosystem.config.js file for PM2 in the same folder.

Here is my current config file for PM2:

// PM2 Configuration for running Node-RED test/dev

module.exports = {
    apps : [{
        name: 'Node-RED',
        script: 'C:/src/nr/node_modules/node-red/red.js',

        // Options reference:
        args: '--userDir ./data',
        // instances: 1,
        // autorestart: true,
        watch: [
        ignore_watch: [
        // max_memory_restart: '1G',
        env: {
            NODE_ENV: 'development',
            TI_ENV: 'debug',
            //DEBUG: 'express:paths,express:router',
        env_production: {
            NODE_ENV: 'production'
        //shutdown_with_message: true,
        //kill_timeout : 3000,
        //listen_timeout: 10000,
        error_file: 'C:/src/nr/logout.log',  // default: $HOME/.pm2/logs/XXXerr.log
        out_file: 'C:/src/nr/logout.log',      // default: $HOME/.pm2/logs/XXXout.log
        pid_file: 'C:/src/nr/',      // default: $HOME/.pm2/pid/
        combine_logs: true,
        merge_logs: true,
        //log_date_format: 'DD HH:mm',                    // default: 'YYYY-MM-DD HH:mm Z'

And the package.json scripts:

  "scripts": {
    "start": "pm2 start ecosystem.config.js && pm2 logs",
    "restart": "pm2 restart Node-RED --update-env && pm2 logs",

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.