Unknown issue. I was asked to report this


Unexpected Node Error


Info:
Node object is not a node-red Node
Stack:
TypeError: Cannot read property 'length' of undefined
at TimeSchedulerNode.Node.close (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:319:41)
at stopNode (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:746:31)
at Flow.stop (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:388:35)
at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:482:43
at Array.forEach ()
at stop (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:478:19)
at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:220:20

Please report this issue, including the information logged above:
https..

Thanks for reporting, but we need some context.

  • What nodes do you have installed (check your package.json file in ~/.node-red)
  • Version of Node RED
  • Version of Node
  • OS
  • Full Node RED start up log

Startup log:
28 Feb 20:38:25 - [info]

Welcome to Node-RED

28 Feb 20:38:25 - [info] Node-RED version: v3.1.5
28 Feb 20:38:25 - [info] Node.js version: v20.11.1
28 Feb 20:38:25 - [info] Linux 6.1.21-v8+ arm64 LE
28 Feb 20:38:26 - [info] Loading palette nodes
28 Feb 20:38:27 - [info] Dashboard version 1.0.2 started at /ui
28 Feb 20:38:29 - [warn] ------------------------------------------------------
28 Feb 20:38:29 - [warn] [node-red-contrib-moment2/moment] 'moment' already registered by module node-red-contrib-moment
28 Feb 20:38:29 - [warn] ------------------------------------------------------
28 Feb 20:38:29 - [info] Settings file : /home/lennart/.node-red/settings.js
28 Feb 20:38:29 - [info] Context store : 'default' [module=memory]
28 Feb 20:38:29 - [info] User directory : /home/lennart/.node-red
28 Feb 20:38:29 - [warn] Projects disabled : editorTheme.projects.enabled=false
28 Feb 20:38:29 - [info] Flows file : /home/lennart/.node-red/start
28 Feb 20:38:29 - [info] Creating new flow file
28 Feb 20:38:29 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

28 Feb 20:38:29 - [warn] Encrypted credentials not found
28 Feb 20:38:29 - [error] Unable to listen on http://127.0.0.1:1880/
28 Feb 20:38:29 - [error] Error: port in use

The error turned up after upgrading nodes.js

I do not know how to list all nodes used, it is 20

That probably explains it. After upgrading nodejs it is necessary to rebuild modules that have compiled components. If you are on a Debian based system (such as Ubuntu or Pi OS) the easiest way to do that is to re-run the install script from Running on Raspberry Pi : Node-RED

I don't think this is related to the problem you've reported. However, you have 2 nodes installed that have clashing names. The original moment node written by me that has a full readme and was updated a few months ago and a copy written by someone else that has no readme so it isn't clear what it is for and hasn't been updated in 8 years.

Here is the package.json file
"name": "node-red-project",
"description": "initially created for you by Node-RED 2.2.2 ",
"version": "0.0.1",
"private": true,
"dependencies": {
"dashboard-evi": "~1.0.2",
"node-red-contrib-buffer-parser": "^3.2.2",
"node-red-contrib-moment": "~5.0.0",
"node-red-contrib-moment2": "~1.0.5",
"node-red-contrib-mssql": "0.0.7",
"node-red-contrib-ownet": "~0.1.5",
"node-red-contrib-persist": "~1.1.1",
"node-red-contrib-play-audio": "^2.5.0",
"node-red-contrib-timerswitch": "~1.4.0",
"node-red-contrib-ui-artless-gauge": "~0.3.12",
"node-red-contrib-ui-time-scheduler-italian": "~1.17.8",
"node-red-node-email": "~1.18.2",
"node-red-node-pi-gpio": "^2.0.6",
"node-red-node-ping": "^0.3.3",
"node-red-node-random": "^0.4.1",
"node-red-node-serialport": "^2.0.2",
"node-red-node-smooth": "^0.1.2",
"nodered-contrib-sms77": "~3.2.2"

As I say, get rid of moment2 and then follow Colin's guidance and do:

cd ~/.node-red
npm rebuild

Then restart and see if that helps.

I believe the script will do that for you.

I think that dashboard may well not be compatible with node-red-contrib-ui-artless-gauge. Unless you have a good reason for using it I recommend the dashboard usually used which is node-red-dashboard.

1 Like

I have finally got rid of the error. But I did not manage to un-install Moment 2. It is claimed to be in use even after deleting it from the flow where I used it.
Thanks for your help!

In a command window go into the .node-red folder and run
npm remove node-red-contrib-moment2
then restart node-red.

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