# Error loading node-red

**URL:** <https://discourse.nodered.org/t/error-loading-node-red/47219>\
**Category:** General\
**Created:** [16 June 2021 06:40 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219 "2021-06-16T06:40:39Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)\
**Post date:** [16 June 2021 06:40 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/1 "2021-06-16T06:40:39Z")

</div>

I'm getting error while running node-red. I followed the forum:

> [@Windows 10 \[error\] Failed to start server: \[error\] TypeError: Cannot read property](https://discourse.nodered.org/t/windows-10-error-failed-to-start-server-error-typeerror-cannot-read-property/18600/8):
>
> Hi @dougcr4 this is a rare issue that we've never managed to get to the root cause of. If you are still hitting it, could I trouble you to add a bit of debug into the code to help us figure it out? Specifically, if you edit the file C:\Users\Dell\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\registry\lib\registry.js and look at line 186 you should see: set.types.forEach(function(t) { if (nodeTypeToId.hasOwnProperty(t)) { Please add the …

Added the DEBUG line & getting the details as follows.

> SyntaxError: missing ) after argument list  
> at Object.compileFunction (node:vm:353:18)  
> at wrapSafe (node:internal/modules/cjs/loader:1039:15)  
> at Module.\_compile (node:internal/modules/cjs/loader:1073:27)  
> at Object.Module.\_extensions..js (node:internal/modules/cjs/loader:1138:10)  
> at Module.load (node:internal/modules/cjs/loader:989:32)  
> at Function.Module.\_load (node:internal/modules/cjs/loader:829:14)  
> at Module.require (node:internal/modules/cjs/loader:1013:19)  
> at require (node:internal/modules/cjs/helpers:93:18)  
> at Object. (C:\Users\Sahil\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\registry\lib\index.js:27:16)  
> at Module.\_compile (node:internal/modules/cjs/loader:1109:14)

Can anyone help what should be done next?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [16 June 2021 06:47 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/2 "2021-06-16T06:47:32Z")

</div>

If you added the debug lines as Nick suggested...

> [@Windows 10 \[error\] Failed to start server: \[error\] TypeError: Cannot read property](https://discourse.nodered.org/t/windows-10-error-failed-to-start-server-error-typeerror-cannot-read-property/18600/8):
>
> Please add the following immediately before it:
> 
> ```auto
> // START DEBUG
> if (!set.types) {
> console.log("Module:",module.name);
> console.log("Path:",module.path);
> console.log("Set:",setName);
> }
> // END DEBUG
> set.types.forEach(function(t) {
> if (nodeTypeToId.hasOwnProperty(t)) {
> 
> ```
> 
> The next time you restart Node-RED you'll get a bit more information in the log about what node module its loading when it hits the error

... what was the reason for adding those?

What error were you getting that prompted you add these debug lines?

---

<div class="post-metadata">

**Author:** ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)\
**Post date:** [16 June 2021 06:53 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/3 "2021-06-16T06:53:52Z")

</div>

Just as the post suggested to find out the node causing the error. So I can "npm remove" the node. 😕

This was the error I was getting:

> # Welcome to Node-RED
> 
> 16 Jun 11:54:53 - [info] Node-RED version: v1.3.5  
> 16 Jun 11:54:53 - [info] Node.js version: v16.3.0  
> 16 Jun 11:54:53 - [info] Windows\_NT 10.0.19042 x64 LE  
> 16 Jun 11:54:58 - [info] Loading palette nodes  
> 16 Jun 11:55:05 - [error] Failed to start server:  
> 16 Jun 11:55:05 - [error] TypeError: Cannot read property 'forEach' of undefined  
> at Object.addModule (C:\Users\Sahil\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\registry\lib\registry.js:195:27)  
> at C:\Users\Sahil\AppData\Roaming\npm\node\_modules\node-red\node\_modules@node-red\registry\lib\loader.js:153:34

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [16 June 2021 06:57 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/4 "2021-06-16T06:57:28Z")

</div>

ok, I get that, however the original error on that post is `TypeError: Cannot read property 'forEach' of undefined`

You are getting `SyntaxError: missing ) after argument list`

This suggests you have a different problem OR you have made a mistake when adding the debug lines.

so I will ask again, what error were you getting (originally) before you added these debug lines?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [16 June 2021 06:59 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/5 "2021-06-16T06:59:15Z")

</div>

I see you edited your post while I was typing.

Ok, so you have possibly made a mistake when adding the debug lines causing the error `SyntaxError: missing ) after argument list`.

Show us a few lines before and a few lines after where you added the debug code.

---

<div class="post-metadata">

**Author:** ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)\
**Post date:** [16 June 2021 07:00 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/6 "2021-06-16T07:00:21Z")

</div>

Before adding the debug line this was shown:

 ![screenshot 1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/a/da95053132d222c07927242e35c148edd3a10fa7.png)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [16 June 2021 09:57 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/7 "2021-06-16T09:57:36Z")

</div>

Try putting a `catch` node connected to a `debug` node (set to display the complete msg object) in the flow and see if it shows anything.

---

<div class="post-metadata">

**Author:** ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)\
**Post date:** [16 June 2021 10:24 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/8 "2021-06-16T10:24:56Z")

</div>

I panicked and got caught up in a cycle of re-installing node.js & even downgraded to previous build of windows 10.  
 ![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/c/0c90e907edf5f48f444f6861d7397cc0481a83d2.jpeg)

Thought it over again and gave a another try & deleted the last node I added "ui-etable" manually from location  
C:\Users\user-name\ .node-red\node\_modules  
It seems to be working now.  
 ![2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/1/91f073df53a9f38b9ace7ef7d0eb97724f303348.jpeg)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [16 June 2021 10:38 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/9 "2021-06-16T10:38:15Z")

</div>

> [@sahsha](#):
>
> re-installing node.js

Overkill

> [@sahsha](#):
>
> downgraded to previous build of windows 10.

Extreme overkill.

* * *

The worst you would need to do is delete node modules / clear npm cache OR downgrade node js to LTS version.

---

<div class="post-metadata">

**Author:** ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)\
**Post date:** [17 June 2021 09:06 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/10 "2021-06-17T09:06:18Z")

</div>

" **node-red-node-ui-etable**" appeared again  
 ![screenshot 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d4bc00c781e10723ef26807a15efde3421e3af1d.png)

and so node-red has stopped again  
 ![screenshot 3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d1ea00163d6de4848247cbd17fd54c618cee886e.png)

when I delete the folder it works for some while then it re-appears and sever disconnects.  
Have I done something wrong which is causing this?  
😕

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 June 2021 09:09 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/11 "2021-06-17T09:09:36Z")

</div>

it is probably in package.json

- open a command prompt & uninstall it property...

- check folder is gone from `c:\users\Sahil\.node-red\node_modules`

- restart node-red

---

<div class="post-metadata">

**Author:** ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)\
**Post date:** [17 June 2021 09:15 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/12 "2021-06-17T09:15:21Z")

</div>

Flows have started but also showing the below warning

> (node:5628) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\Users\Sahil.node-red\node\_modules\node-red-dashboard\package.json' of 'none'. Please either fix that or report it to the module author

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 June 2021 09:17 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/13 "2021-06-17T09:17:02Z")

</div>

I suspect you are using node-js v16 - this is noted & it is only a waring - your problem is fixed.

---

<div class="post-metadata">

**Author:** ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)\
**Post date:** [17 June 2021 09:21 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/14 "2021-06-17T09:21:34Z")

</div>

Yes, I'm using _node-v16.3.0_. Thankyou.

---

<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:** [1 July 2021 09:22 UTC](https://discourse.nodered.org/t/error-loading-node-red/47219/15 "2021-07-01T09:22:28Z")

</div>

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