Node red foreach error

Please help! I was busy with creating a ui with a table and text fields when all of a sudden my node red close and I got this error in command prompt. I thought the problem was in my flow so I copied my flow file out and completely removed node red and uninstalled node.js. I made sure everything was removed, restarted my pc and started installing everything again but still got the error. I am rather new to node red so all my I am still training. The error is below:

[error] TypeError: Cannot read property 'forEach' of undefined
    at Object.addModule (C:\Users\Manie\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\registry.js:186:27)
    at C:\Users\Manie\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\loader.js:108:30
    at tryCatchReject (C:\Users\Manie\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:845:30)
    at runContinuation1 (C:\Users\Manie\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:804:4)
    at Fulfilled.when (C:\Users\Manie\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:592:4)
    at Pending.run (C:\Users\Manie\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:483:13)
    at Scheduler._drain (C:\Users\Manie\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\Scheduler.js:62:19)
    at Scheduler.drain (C:\Users\Manie\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\Scheduler.js:27:9)
    at processTicksAndRejections (node:internal/process/task_queues:76:11
)

That error is caused by having a badly written node installed. Have you installed any new nodes recently, or perhaps tried developing your own?

No, no new nodes and yes have been developing after having a short crash course to get me going. I had a table with some text fields and I was busy sorting them the way I wanted when this happened the first time.

start node-red with 'node-red --safe' and see if you startup with out a problem.

If you do, disable the node you were playing wth and deploy and see if that prevents the issue. That will at least narrow down the cause.

Also, could you attach your flow to a reply? In order to make code more readable and importable it is important to surround your code with three backticks

```like this```

You can edit and correct your post by clicking the pencil icon.

See this post for more details - How to share code or flow json

Below is my flow code.

[{"id":"cf8dbb6c.418578","type":"tab","label":"SQL Data","disabled":false,"info":""},{"id":"adcc8ab.53ef578","type":"tab","label":"Persons","disabled":false,"info":""},{"id":"2df6556d.91840a","type":"MSSQL-CN","name":"AddressBook MSSQL","server":"127.0.0.1","encyption":true,"database":"MWT-AddressBook-Test"},{"id":"8dd33c30.79f7c","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0096cc","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0096cc","edited":true},"page-titlebar-backgroundColor":{"value":"#0096cc","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1ac2ff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0096cc","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"85b2f0aa.9f15","type":"ui_tab","name":"Input Address","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"213511c9.74f04e","type":"ui_group","name":"Persons Inputs","tab":"85b2f0aa.9f15","order":1,"disp":true,"width":"30","collapse":false},{"id":"aa16b199.90224","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":5,"width":7,"height":1},{"id":"ebff0c21.5146","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":8,"width":7,"height":1},{"id":"86a99f8e.f95c5","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":11,"width":7,"height":1},{"id":"952afff1.638aa","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":14,"width":7,"height":1},{"id":"679248e8.bab098","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":17,"width":7,"height":1},{"id":"2a33ebb1.ec17e4","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":20,"width":7,"height":1},{"id":"173e5cb6.287403","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":23,"width":7,"height":1},{"id":"be97ff07.7615","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":26,"width":7,"height":1},{"id":"cf9554b.944aaa8","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":29,"width":7,"height":1},{"id":"2194f328.d26bbc","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":32,"width":7,"height":1},{"id":"cef3e971.5b7bf8","type":"ui_spacer","name":"spacer","group":"","order":1,"width":1,"height":1},{"id":"9b755ae6.fc5938","type":"ui_group","name":"Person List","tab":"85b2f0aa.9f15","order":2,"disp":true,"width":"27","collapse":true},{"id":"3dbc29f7.b1e346","type":"ui_spacer","name":"spacer","group":"213511c9.74f04e","order":1,"width":1,"height":1},{"id":"ff60d02b.4c431","type":"inject","z":"cf8dbb6c.418578","name":"GetData","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":80,"y":40,"wires":[["f66a04f0.ade328"]]},{"id":"b0e5a7d9.93ae58","type":"MSSQL","z":"cf8dbb6c.418578","mssqlCN":"2df6556d.91840a","name":"AddressBook MSSQL","query":"SELECT * FROM tbl_Person","outField":"payload","x":480,"y":40,"wires":[["4809a6ee.efd348","2768613a.477ffe"]]},{"id":"4809a6ee.efd348","type":"debug","z":"cf8dbb6c.418578","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":60,"wires":[]},{"id":"157f52f1.97a60d","type":"http in","z":"cf8dbb6c.418578","name":"Read","url":"/addresses","method":"get","upload":false,"swaggerDoc":"","x":70,"y":100,"wires":[["f66a04f0.ade328"]]},{"id":"f66a04f0.ade328","type":"template","z":"cf8dbb6c.418578","name":"List Addresses","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html>\n    <head>\n        <link href=\"https://cdnjs.cloudflare.com/ajax/libs/bootswatch/4.5.3/slate/bootstrap.min.css\" rel=\"stylesheet\"/>\n    </head>\n<body>\n\n<h1 align=\"center\">Addresses</h1>\n<table style=\"width:100%\">\n  <tr>\n    <th>Firstname</th>\n    <th>Lastname</th>\n    <th>Age</th>\n  </tr>\n  <tr>\n    <td>Jill</td>\n    <td>Smith</td>\n    <td>50</td>\n  </tr>\n  <tr>\n    <td>Eve</td>\n    <td>Jackson</td>\n    <td>94</td>\n  </tr>\n</table>\n\n</body>\n</html>","output":"str","x":260,"y":40,"wires":[["b0e5a7d9.93ae58"]]},{"id":"2768613a.477ffe","type":"http response","z":"cf8dbb6c.418578","name":"","statusCode":"","headers":{},"x":740,"y":120,"wires":[]},{"id":"c536a609.7eb078","type":"ui_text_input","z":"adcc8ab.53ef578","name":"First_Name","label":"","tooltip":"","group":"213511c9.74f04e","order":4,"width":6,"height":1,"passthru":false,"mode":"text","delay":"0","topic":"First_Name","x":1250,"y":60,"wires":[[]]},{"id":"3b7d0431.f5261c","type":"MSSQL","z":"adcc8ab.53ef578","mssqlCN":"2df6556d.91840a","name":"Select","query":"","outField":"payload","x":350,"y":80,"wires":[["93e51649.f82748","6388fb6.61c5704","da3793b7.fe5b3","4c59f987.1dc928","6a5bca4.0447334","77e669b.fc8f198","1b7918d9.5365e7","86289b76.5dd518","4b0a8c23.e1e364","dcb44cc5.08259","9415b77b.981e28","96b4185.ab580e8"]]},{"id":"1f37bc02.c14b44","type":"ui_text_input","z":"adcc8ab.53ef578","name":"Last_Name","label":"","tooltip":"","group":"213511c9.74f04e","order":7,"width":6,"height":1,"passthru":false,"mode":"text","delay":"300","topic":"Last_Name","x":1250,"y":140,"wires":[[]]},{"id":"de374fcd.3e06a","type":"inject","z":"adcc8ab.53ef578","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":70,"y":80,"wires":[["4dadc75c.77bd08"]]},{"id":"de759d1d.1e31e","type":"ui_text_input","z":"adcc8ab.53ef578","name":"Address1","label":"","tooltip":"","group":"213511c9.74f04e","order":10,"width":6,"height":1,"passthru":false,"mode":"text","delay":"0","topic":"Address1","x":1240,"y":220,"wires":[[]]},{"id":"64f060f6.eece9","type":"ui_text_input","z":"adcc8ab.53ef578","name":"Address2","label":"","tooltip":"","group":"213511c9.74f04e","order":13,"width":6,"height":1,"passthru":false,"mode":"text","delay":"0","topic":"Address2","x":1240,"y":300,"wires":[[]]},{"id":"2d4f7da6.f08ca2","type":"ui_text_input","z":"adcc8ab.53ef578","name":"Address3","label":"","tooltip":"","group":"213511c9.74f04e","order":16,"width":6,"height":1,"passthru":false,"mode":"text","delay":"0","topic":"Address3","x":1240,"y":380,"wires":[[]]},{"id":"4f9f4678.01e4b8","type":"ui_text_input","z":"adcc8ab.53ef578","name":"Address4","label":"","tooltip":"","group":"213511c9.74f04e","order":19,"width":6,"height":1,"passthru":false,"mode":"text","delay":"0","topic":"Address4","x":1240,"y":460,"wires":[[]]},{"id":"f1653c05.86148","type":"ui_text_input","z":"adcc8ab.53ef578","name":"Postal_Code","label":"","tooltip":"","group":"213511c9.74f04e","order":25,"width":6,"height":1,"passthru":false,"mode":"text","delay":"0","topic":"Postal_Code","x":1250,"y":540,"wires":[[]]},{"id":"ca366145.3f6f1","type":"ui_text_input","z":"adcc8ab.53ef578","name":"Home_Tel","label":"","tooltip":"","group":"213511c9.74f04e","order":22,"width":6,"height":1,"passthru":true,"mode":"text","delay":300,"topic":"Home_Tel","x":1240,"y":620,"wires":[[]]},{"id":"9c06546e.572848","type":"ui_text_input","z":"adcc8ab.53ef578","name":"Work_Tel","label":"","tooltip":"","group":"213511c9.74f04e","order":28,"width":6,"height":1,"passthru":false,"mode":"text","delay":"0","topic":"Work_Tel","x":1240,"y":700,"wires":[[]]},{"id":"fecf3304.cd918","type":"ui_text_input","z":"adcc8ab.53ef578","name":"CellPhone","label":"","tooltip":"","group":"213511c9.74f04e","order":31,"width":6,"height":1,"passthru":false,"mode":"text","delay":"0","topic":"CellPhone","x":1250,"y":780,"wires":[[]]},{"id":"5d434bc7.9677e4","type":"ui_text_input","z":"adcc8ab.53ef578","name":"EMail","label":"","tooltip":"","group":"213511c9.74f04e","order":34,"width":6,"height":1,"passthru":true,"mode":"text","delay":300,"topic":"EMail","x":1230,"y":860,"wires":[[]]},{"id":"4e2f1a00.e47824","type":"debug","z":"adcc8ab.53ef578","name":"Debug Select","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":380,"y":40,"wires":[]},{"id":"4dadc75c.77bd08","type":"function","z":"adcc8ab.53ef578","name":"Select","func":"var Person_ID = 1;\n\nmsg.payload = `SELECT Person_ID\n     , First_Name\n     , Last_Name\n     , Address1\n     , Address2\n     , Address3\n     , Address4\n     , Postal_Code\n     , Home_Tel\n     , Work_Tel\n     , CellPhone\n     , EMail\nFROM dbo.tbl_Person \nWHERE Person_ID = `  + Person_ID;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":210,"y":80,"wires":[["3b7d0431.f5261c","4e2f1a00.e47824"]]},{"id":"93e51649.f82748","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].First_Name});\n//return msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":80,"wires":[["c536a609.7eb078","769c4be6.c77014"]]},{"id":"6388fb6.61c5704","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].Last_Name});\n//return x;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":140,"wires":[["1f37bc02.c14b44","aab957be.5a89a8"]]},{"id":"9415b77b.981e28","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].Address2});","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":260,"wires":[["64f060f6.eece9","d118cd2b.662f5"]]},{"id":"1b7918d9.5365e7","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].Home_Tel});","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":500,"wires":[["ca366145.3f6f1","3dbcbb5b.11ad84"]]},{"id":"4c59f987.1dc928","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].Address3});","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":320,"wires":[["2d4f7da6.f08ca2","4cd63b12.6faf24"]]},{"id":"6a5bca4.0447334","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].Address4});","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":380,"wires":[["4f9f4678.01e4b8","c9ab2287.ecc13"]]},{"id":"77e669b.fc8f198","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].Postal_Code});","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":440,"wires":[["f1653c05.86148","e82f8b9c.8936c8"]]},{"id":"da3793b7.fe5b3","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].Address1});\n//return x;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":200,"wires":[["de759d1d.1e31e","1beef832.d2fb78"]]},{"id":"dcb44cc5.08259","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].Work_Tel});","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":560,"wires":[["9c06546e.572848","5391e8b.e184c18"]]},{"id":"86289b76.5dd518","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].CellPhone});","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":620,"wires":[["fecf3304.cd918","cc9e7343.1e035"]]},{"id":"4b0a8c23.e1e364","type":"function","z":"adcc8ab.53ef578","name":"","func":"node.send({\"payload\" : msg.payload[0].EMail});","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":680,"wires":[["5d434bc7.9677e4","f4ec8e43.9c8bd"]]},{"id":"96b4185.ab580e8","type":"ui_table","z":"adcc8ab.53ef578","group":"9b755ae6.fc5938","name":"","order":1,"width":"27","height":11,"columns":[],"outputs":0,"cts":false,"x":410,"y":220,"wires":[]},{"id":"b1308de2.99935","type":"function","z":"adcc8ab.53ef578","name":"Select","func":"\n\n\nmsg.payload = `SELECT Person_ID\n     , First_Name\n     , Last_Name\n     , Address1\n     , Address2\n     , Address3\n     , Address4\n     , Postal_Code\n     , Home_Tel\n     , Work_Tel\n     , CellPhone\n     , EMail\nFROM dbo.tbl_Person`;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":210,"y":140,"wires":[["3b7d0431.f5261c"]]},{"id":"3e2cf0cf.24cd9","type":"inject","z":"adcc8ab.53ef578","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":70,"y":140,"wires":[["b1308de2.99935"]]},{"id":"769c4be6.c77014","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":3,"width":4,"height":1,"name":"FirstName","label":"First Name","format":"","layout":"row-right","x":1250,"y":20,"wires":[]},{"id":"aab957be.5a89a8","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":6,"width":4,"height":1,"name":"LastName","label":"Last Name","format":"","layout":"row-right","x":1250,"y":100,"wires":[]},{"id":"1beef832.d2fb78","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":9,"width":4,"height":1,"name":"Address1","label":"Address 1","format":"","layout":"row-right","x":1240,"y":180,"wires":[]},{"id":"d118cd2b.662f5","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":12,"width":4,"height":1,"name":"Address2","label":"Address 2","format":"","layout":"row-right","x":1240,"y":260,"wires":[]},{"id":"4cd63b12.6faf24","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":15,"width":4,"height":1,"name":"Address3","label":"Address 3","format":"","layout":"row-right","x":1240,"y":340,"wires":[]},{"id":"c9ab2287.ecc13","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":18,"width":4,"height":1,"name":"Address4","label":"Address 4","format":"","layout":"row-right","x":1240,"y":420,"wires":[]},{"id":"e82f8b9c.8936c8","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":21,"width":4,"height":1,"name":"PostalCode","label":"Postal Code","format":"","layout":"row-right","x":1250,"y":500,"wires":[]},{"id":"3dbcbb5b.11ad84","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":24,"width":4,"height":1,"name":"HomeTel","label":"Home Tel","format":"","layout":"row-right","x":1240,"y":580,"wires":[]},{"id":"5391e8b.e184c18","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":27,"width":4,"height":1,"name":"WorkTel","label":"Work Tel","format":"","layout":"row-right","x":1240,"y":660,"wires":[]},{"id":"cc9e7343.1e035","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":30,"width":4,"height":1,"name":"CellPhone","label":"Cell Phone","format":"","layout":"row-right","x":1250,"y":740,"wires":[]},{"id":"f4ec8e43.9c8bd","type":"ui_text","z":"adcc8ab.53ef578","group":"213511c9.74f04e","order":33,"width":4,"height":1,"name":"EMail","label":"E-Mail","format":"","layout":"row-right","x":1230,"y":820,"wires":[]}]

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