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

**URL:** <https://discourse.nodered.org/t/refresh-a-running-node-red-instance-after-npm-install-mynode/63338>\
**Category:** General\
**Created:** [1 June 2022 04:51 UTC](https://discourse.nodered.org/t/refresh-a-running-node-red-instance-after-npm-install-mynode/63338 "2022-06-01T04:51:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![schwebo](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@schwebo](https://discourse.nodered.org/u/schwebo)\
**Post date:** [1 June 2022 04:51 UTC](https://discourse.nodered.org/t/refresh-a-running-node-red-instance-after-npm-install-mynode/63338/1 "2022-06-01T04:51:38Z")

</div>

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!?😉

Thanks a lot folks:=

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [1 June 2022 05:08 UTC](https://discourse.nodered.org/t/refresh-a-running-node-red-instance-after-npm-install-mynode/63338/2 "2022-06-01T05:08:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![schwebo](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@schwebo](https://discourse.nodered.org/u/schwebo)\
**Post date:** [1 June 2022 05:23 UTC](https://discourse.nodered.org/t/refresh-a-running-node-red-instance-after-npm-install-mynode/63338/3 "2022-06-01T05:23:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 June 2022 08:24 UTC](https://discourse.nodered.org/t/refresh-a-running-node-red-instance-after-npm-install-mynode/63338/4 "2022-06-01T08:24:30Z")

</div>

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:

```auto
// 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: https://pm2.keymetrics.io/docs/usage/application-declaration/
        args: '--userDir ./data',
        // instances: 1,
        // autorestart: true,
        watch: [
            'C:/src/nr/data/settings.js',
            'C:/src/nr/data/projects/uib1/uibuilder/.config/security.js',
            'C:/src/node-red-contrib-infocache/nodes/',
            'C:/src/node-red-contrib-uibuilder/nodes/',
            'C:/src/node-red-contrib-pouchdb/nodes/',
            'C:/src/node-red-contrib-jktesting/nodes/',
            'C:/src/node-red-contrib-events/nodes/',
            'C:/src/node-red-contrib-drayton-wiser/nodes/',
            'C:/src/node-red-experimental-nodes/nodes/',
            'C:/src/node-red-experimental-nodes/package.json',
            'C:/src/nr-test/nodes/',
            'C:/src/nr/data/settings.js',
            'C:/src/nr/node_modules/node-red/red.js',
            'C:/src/nr/node_modules/@node-red/runtime/lib/nodes/index.js',
            //'C:/src/nr-source/ti-theme/style.css'
        ],
        ignore_watch: [
            'C:/src/nr/node_modules',
            'C:/src/nr/data/node_modules',
            'C:/src/nr/.vscode',
            'C:/src/node-red-contrib-uibuilder/front-end/dist',
            'C:/src/node-red-contrib-uibuilder/nodes/icons',
            'C:/src/node-red-contrib-uibuilder/nodes/.*\.html',
            'C:/src/node-red-contrib-uibuilder/front-end/src',
            'C:/src/node-red-contrib-uibuilder/templates',
            'C:/src/node-red-contrib-uibuilder/node-src',
            'C:/src/node-red-contrib-events/nodes/.*\.html',
            'C:/src/node-red-contrib-drayton-wiser/nodes/.*\.html',
            'C:/src/node-red-contrib-drayton-wiser/src/.*',
            'C:/src/node-red-experimental-nodes/nodes/.*\.html',
        ],
        // 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/nrtest.pid', // default: $HOME/.pm2/pid/app-pm_id.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:

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

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [31 July 2022 08:25 UTC](https://discourse.nodered.org/t/refresh-a-running-node-red-instance-after-npm-install-mynode/63338/5 "2022-07-31T08:25:26Z")

</div>

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