Error Loading palette nodes after restart

Hi, I'm using node-red inside a nodejs service. (node-red 2.2.2)

I use this code for restart the runtime:
RED.stop()
        .then(() => {
            RED.init(server,red_settings);
            return RED.start();
        })

throws this:

8 Jul 09:36:54 - [info] Stopping flows
8 Jul 09:36:54 - [info] Stopped flows
8 Jul 09:36:54 - [info]

Welcome to Node-RED

8 Jul 09:36:54 - [info] Node-RED version: v2.2.2-git
8 Jul 09:36:54 - [info] Node.js version: v16.14.2
8 Jul 09:36:54 - [info] Darwin 21.4.0 arm64 LE
8 Jul 09:36:54 - [info] Loading palette nodes
ypeError: Cannot read properties of undefined (reading 'version')
at Object.getModuleInfo (/service/node_modules/@node-red/registry/lib/registry.js:378:44)
at loadModuleFiles (/service/node_modules/@node-red/registry/lib/loader.js:116:51)
at load (/service/node_modules/@node-red/registry/lib/loader.js:43:12)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)

thanks

I don't know much about running Node RED as an imbedded service.
but should you be initing again?

maybe remove the init (since it was already done so at the start)

RED.stop()
        .then(() => {
            return RED.start();
        })

:man_shrugging:

no difference when removing the RED.init();

Actually, I added the init() trying to fix the problem

The runtime isn't designed to be stopped and restarted like that.

There's a long standing issue on the backlog to do the work to enable that, but as it isn't something the non-embedded version of Node-RED needs, it just hasn't had the attention needed.

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