Node and plugin in same package.json

Hello everyone, i'm trying to prepare the package for my own set of nodes and i've encountered a problem.
I have a plugin node and various other nodes and i want them to be installed in a single package but this keeps returning me an error if the plugins and node sections are together.

Basically this is my package.json:

  "name": "@sss/node-red-sss-dataManipulation",
  "version": "1.0.0",
  "description": "",
  "dependencies": {
		"axios": "^0.27.2",
		"crypto": "^1.0.1",
		"node-rsa": "^1.1.1",
		"rsa-pem-from-mod-exp": "^0.8.4",
		"utf8": "^3.0.0",
		"uuid": "^9.0.0",
		"mysql2": "^2.3.3",
        "pg": "^8.8.0",
		"alasql": "^1.7.3",
		"xlsx": "",
		"sss-server": "file:./sss_server"
  "node-red": {
    "nodes": {
      "addcolumns": "sss_add_columns/addcolumns.js",
	  "create-view": "sss_create_view/create-view.js",
  	  "csv2array": "sss_csv2array/sss-csv2array.js",
	  "db-hub": "sss_db_hub/db-hub.js",
	  "filter": "sss_filter/sss-filter.js",
	  "get-view-values": "sss_get_view_values/get-view-values.js",
	  "joinmatrix": "sss_join_matrix/joinmatrix.js",
	  "merge-messages": "sss_merge_messages/merge-messages.js",
	  "register-notification": "sss_register_notification/register-notification.js",
	  "renamelabels": "sss_rename_labels/renamelabels.js",
	  "sss-server": "sss_server/sss-server.js",
	  "update-view": "sss_update_view/update-view.js",
	  "sss-user": "sss_user/sss-user.js",
	  "xlsx2array": "sss_xlsx2array/sss_xlsx2Array.js"

    "plugins": {
	  "sss-api": "sss_api/sss-api.js"
  "author": "DocSpace",
  "license": "ISC"

this does not work giving a similar exception:

TypeError: Cannot read properties of undefined (reading 'forEach')
at Object.addModule (/usr/src/node-red/node_modules/@node-red/registry/lib/registry.js:195:27)
at /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js:138:34

Is there a way to fix this?
Strangely, if i put my plugin node inside the nodes section everything will work except for a warning displayed at the start of nodered:

[warn] [@sss/node-red-sss-dataManipulation/sss-api] TypeError: Cannot read properties of undefined (reading 'plugins') 

I came across someone with the same problem : How do Node-RED plugins work?

Is it fixable?

Thanks in advance

This may simply be a bug in Node-RED around how it handles modules that have both plugins and nodes in.

I know that's something I tested when we introduced plugins, but I cannot immediately point to an example module that does this today.

I think we need to investigate a bit more closely.

Depending on what you have in the plugin code, a working could be to list it in the nodes section... but again, you'd need to test that carefully to make sure it behaved as you wanted.

1 Like

Ok, i'll check for good, thanks a lot

As per my reply in the other thread, looks like you've hit this known issue: Race condition when loading module with both Plugin and Nodes · Issue #3523 · node-red/node-red (

1 Like

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