# Cannot start node-red!

**URL:** <https://discourse.nodered.org/t/cannot-start-node-red/62891>\
**Category:** General\
**Created:** [20 May 2022 18:13 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891 "2022-05-20T18:13:51Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![tai34126](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@tai34126](https://discourse.nodered.org/u/tai34126)\
**Post date:** [20 May 2022 18:13 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/1 "2022-05-20T18:13:51Z")

</div>

hey guys!!! I have the big problem!! I cannot use my node red.

 ![errorrr](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/1/1183f3be2293e67c82008169ff65c4e192323f68.png)

please help me T-T

---

<div class="post-metadata">

**Author:** ![tai34126](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@tai34126](https://discourse.nodered.org/u/tai34126)\
**Post date:** [20 May 2022 18:24 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/2 "2022-05-20T18:24:02Z")

</div>

help me. I am crying now. because my project will be send this day.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [20 May 2022 19:03 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/3 "2022-05-20T19:03:17Z")

</div>

You are using a very old version of Node-RED. Any reason you have not updated to 2.2.2?

This can be caused by badly implemented nodes. Have you installed anything new recently?

---

<div class="post-metadata">

**Author:** ![tai34126](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@tai34126](https://discourse.nodered.org/u/tai34126)\
**Post date:** [20 May 2022 19:08 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/5 "2022-05-20T19:08:59Z")

</div>

How to update?

I installed node-red-contrib-notifyimage and I write function node  
msg.imagefile = msg.filename  
return msg.imagefile

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 May 2022 21:44 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/6 "2022-05-20T21:44:18Z")

</div>

Restarting in safe mode (check the node-red docs) should let you restart and let you remove the offending node. But as Nick says, you might want to update to the latest version before trying that to see if it fixes the issue.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [20 May 2022 21:56 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/7 "2022-05-20T21:56:35Z")

</div>

> [@TotallyInformation](#):
>
> Restarting in safe mode (check the node-red docs)

Not in this instance. The error is being hit whilst loading the palette - Safe Mode won't help.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [20 May 2022 22:00 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/8 "2022-05-20T22:00:19Z")

</div>

> msg.imagefile = msg.filename  
> return msg.imagefile

I'm sure this is not the cause of the startup issue but this code looks wrong  
Normally a function would return the entire msg object rather than just one element.  
(Is element the right word? Property?)

---

<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:** [20 May 2022 22:02 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/9 "2022-05-20T22:02:29Z")

</div>

> [@tai34126](#):
>
> return msg.imagefile

In a ` function` you return a msg, so you would code `return msg` not `return msg.imagefile`

---

<div class="post-metadata">

**Author:** ![H3llsing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/h3llsing/32/40624_2.png) [@H3llsing](https://discourse.nodered.org/u/H3llsing)\
**Post date:** [20 May 2022 22:04 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/10 "2022-05-20T22:04:18Z")

</div>

hey there, got a few days ago the same error on stable 2.2.2 Version and it was definitively a custom node which was not build correctly. In my case it was my own node which i was debugging.  
so maybe navigating to your data folder usually .node-red and uninstalling the node with npm could fix the Problem.

the foreach is beeing run on an undefined object.  
maybe nodered could also do an additional check here? This would improve the stability.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [20 May 2022 22:09 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/11 "2022-05-20T22:09:37Z")

</div>

> [@H3llsing](#):
>
> maybe nodered could also do an additional check here? This would improve the stability.

This is one of the reasons I suggest to upgrade. This _is_ an area that has been improved since the old release being used.

---

<div class="post-metadata">

**Author:** ![H3llsing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/h3llsing/32/40624_2.png) [@H3llsing](https://discourse.nodered.org/u/H3llsing)\
**Post date:** [20 May 2022 22:47 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/12 "2022-05-20T22:47:27Z")

</div>

i think here is an additional check necessary.

Edit:  
Sorry i got the wrong line.

> <https://github.com/node-red/node-red/blob/98b4b0dce057047c414e7a41b7220384c0c1d11a/packages/node_modules/@node-red/registry/lib/registry.js#L195>

it crashed on node.type.foreach because type was undefined.

i could try to reproduce this error again. i think it was related to a wrong name inside the package.json of the custom node in the nodered section.

I got a typescript setup with yarn mono repo.  
this way i can develop nodes and debugging them live in the code. In the background a node-red instance is started an installs these nodes.

So the error is reproducable if you set a wrong path in the package.json of your custom node. in the node-red section.

EDIT: See error in gif. Right click open picture in new tab makes it fullscreen 🙂  
 ![node-red-custom-node-bug](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/a/5a6c4851389057d08da1edc24d5faf44d241955e.gif)

---

<div class="post-metadata">

**Author:** ![vdhpieter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vdhpieter/32/62503_2.png) [@vdhpieter](https://discourse.nodered.org/u/vdhpieter)\
**Post date:** [1 June 2022 15:48 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/13 "2022-06-01T15:48:50Z")

</div>

@H3llsing it's completely unrelated sorry for that. But is there a chance you can share your TS setup with the hot reload? Have been looking for this and couldn't find something that checks all my boxes and is fairly recent

---

<div class="post-metadata">

**Author:** ![H3llsing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/h3llsing/32/40624_2.png) [@H3llsing](https://discourse.nodered.org/u/H3llsing)\
**Post date:** [2 June 2022 18:47 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/14 "2022-06-02T18:47:14Z")

</div>

@vdhpieter hey there, im currently not at home, but next week im able to share my node including this setup 🙂 i will reply with pm

---

<div class="post-metadata">

**Author:** ![vdhpieter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vdhpieter/32/62503_2.png) [@vdhpieter](https://discourse.nodered.org/u/vdhpieter)\
**Post date:** [15 June 2022 15:44 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/15 "2022-06-15T15:44:36Z")

</div>

@H3llsing sorry to bother you again, would you be open to sharing the node? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![H3llsing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/h3llsing/32/40624_2.png) [@H3llsing](https://discourse.nodered.org/u/H3llsing)\
**Post date:** [16 June 2022 18:03 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/16 "2022-06-16T18:03:04Z")

</div>

@vdhpieter hey pieter sorry i was on vacation 🙂 i just fixed some testing stuff and here you go.  
It's not perfect yet but at least a good start.

> **[GitHub - Devilsmaul/node-red-node-devtool: DevTools for NodeRed nodes](https://github.com/Devilsmaul/node-red-node-devtool)**
>
> DevTools for NodeRed nodes. Contribute to Devilsmaul/node-red-node-devtool development by creating an account on GitHub.

---

<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:** [15 August 2022 18:03 UTC](https://discourse.nodered.org/t/cannot-start-node-red/62891/17 "2022-08-15T18:03:12Z")

</div>

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