# Node-red won't start

**URL:** <https://discourse.nodered.org/t/node-red-wont-start/33762>\
**Category:** General\
**Created:** [5 October 2020 10:02 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762 "2020-10-05T10:02:38Z")\
**Posts on this page:** 20\
**Page:** 2

<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:** [7 October 2020 21:12 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/21 "2020-10-07T21:12:05Z")

</div>

> [@Colin](#):
>
> I don't know what happens on a Windows system if you have something running in a terminal and then close the terminal or reboot. Someone with some knowledge of Windows would have to answer that.

Same as on Linux of Mac 🙂

If the cmd started a process in a sub-shell, the sub-shell will continue. If it didn't, the process will die.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 October 2020 08:30 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/22 "2020-10-08T08:30:23Z")

</div>

> [@TotallyInformation](#):
>
> the process will die.

I think the question is does Death give it some notice so it can self decease cleanly or does He just swing the scythe without warning?

---

<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:** [8 October 2020 09:10 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/23 "2020-10-08T09:10:42Z")

</div>

Ctrl-C certainly does normally cleanly close Node.js apps. This Issue discusses some of the ins and outs:

> <https://github.com/nodejs/node/issues/16103>
>
> Version: v6.11.3
> Platform: 64-bit Windows 10
> CLI: Git 2.14.1
> Express Version: 4.16.1
> 
> Referencing #4182 which seems similar (but at the end, it was stated that...

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 October 2020 09:31 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/24 "2020-10-08T09:31:18Z")

</div>

Yes, but the specific issue is if Windows decides to reboot, presumably it closes the terminal window cleanly, but does that close node red cleanly?

---

<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:** [8 October 2020 09:50 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/25 "2020-10-08T09:50:49Z")

</div>

That should also cleanly shut things down. As I said, the only time it wouldn't cleanly close is if you had a blue-screen error where the whole OS has abruptly terminated.

But from that discussion, it was clear that there are some edge cases.

---

<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:** [8 October 2020 09:56 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/26 "2020-10-08T09:56:00Z")

</div>

Just to update on this - I have added the filename to the error message should it happen again.

As for how we are writing the file - it writes to a temporary file and then, only once that temporary file has been written, renames the file. On the face of it, that should protect against corrupt/half-written files from our side. Even if the node process was killed abruptly, the OS will have either renamed the context file or not. The 'real' file will never be left with half-written data in it.

---

<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:** [8 October 2020 10:01 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/27 "2020-10-08T10:01:58Z")

</div>

That might indicate a more fundamental issue with the device then I think? Possibly an issue with the disk/ssd which could cause those kinds of issues I think.

---

<div class="post-metadata">

**Author:** ![alex88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/alex88/32/55523_2.png) [@alex88](https://discourse.nodered.org/u/alex88)\
**Post date:** [8 October 2020 11:29 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/28 "2020-10-08T11:29:04Z")

</div>

Is there anything I can share to help out?

Any windows logs or Node red logs?

---

<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:** [8 October 2020 16:12 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/29 "2020-10-08T16:12:59Z")

</div>

For this, I don't think anything would appear in the node-red logs. Worth checking the Windows Event logs though. However, they can make for rather scary reading as it is common to find them full of all sorts of strange and inexplicable errors ☹

Given that there are plenty of us running Node-RED on Windows I imagine that this will be a one-off. The density of data on a modern computer is so high that a random thermal or a stray cosmic ray can easily cause a one-off unexplained error.

You might clean out your event logs though and monitor them for a few days to see if there are any recurring errors.

---

<div class="post-metadata">

**Author:** ![alex88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/alex88/32/55523_2.png) [@alex88](https://discourse.nodered.org/u/alex88)\
**Post date:** [22 October 2020 20:10 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/30 "2020-10-22T20:10:10Z")

</div>

I have had to delete my global.json a second time now as node-red crashed and I could not get back in i.e. it would not start again, until I deleted the file.

I wonder if my SSD HDD is deteriorating. However I haven’t seen any other issues in Window 10.

Any idea how I could test to see what the root cause is?

---

<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:** [23 October 2020 19:16 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/31 "2020-10-23T19:16:34Z")

</div>

Did you check the event logs?

There are also a few SSD test utilities out there if you think one might be a problem. Though honestly, most SSD's are very reliable these days. Unless you push them at max utilisation. As with any drive, it is best to look to expand your storage once you get over 80% or so because by that time, you are getting increasing fragmentation issues (SSD's don't care about fragmentation of files but it starts to cause excessive read/writes) and the drive cannot wear-level so easily. Check out the drive manufacturer and see if they have any utilities.

---

<div class="post-metadata">

**Author:** ![alex88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/alex88/32/55523_2.png) [@alex88](https://discourse.nodered.org/u/alex88)\
**Post date:** [23 October 2020 21:29 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/32 "2020-10-23T21:29:38Z")

</div>

Not entirely sure what I'm looking for, but I found this and interestingly I don't remember rebooting my PC.... once I have everything on uibuilder I'll move prod to my lovely little Pi4 😉 and maybe this will be a thing of the past.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e7277646eac413a5aca75b0233852dbd4b38392.png)

---

<div class="post-metadata">

**Author:** ![alex88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/alex88/32/55523_2.png) [@alex88](https://discourse.nodered.org/u/alex88)\
**Post date:** [23 October 2020 21:54 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/33 "2020-10-23T21:54:39Z")

</div>

I'm running node-red as a service now using the PM2 method [here](https://gist.github.com/dceejay/576b4847f0a17dc066db)...

Let's see if that fixes it.

---

<div class="post-metadata">

**Author:** ![alex88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/alex88/32/55523_2.png) [@alex88](https://discourse.nodered.org/u/alex88)\
**Post date:** [20 November 2020 22:30 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/34 "2020-11-20T22:30:20Z")

</div>

ok, so I think the problem has evolved.... Node-RED has been starting nicely. I setup PM2 to run it as a service, however I noticed about 2 weeks ago that data is no longer being stored to disc i.e. each time I restart Node-RED all my history seems to have vanished.

I have tried slightly different context storage options, however this should not be the issue as writing to disc was working fine for at least a couple of months...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/2/6236e4d387e25d289af6d305b45308b906078ba8.png)

I'm going to uninstall node-red and then completely reinstall it in the hope that it fixes the problem, but thought I'd bring it up in case there is a bug somewhere in there.

---

<div class="post-metadata">

**Author:** ![alex88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/alex88/32/55523_2.png) [@alex88](https://discourse.nodered.org/u/alex88)\
**Post date:** [20 November 2020 23:45 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/35 "2020-11-20T23:45:48Z")

</div>

Over 1 hour later, I did a complete uninstall of NR (including renaming the node-red folder) and then reinstall and then all the rest (too many things to list) to get me back up and running.

When I restart flows the variables remain in tact. As soon as I stop the NR service and restart it, I lose all my history data.

I'm at a loss. Any ideas?

PS: I'm using this setting, which is the original setting I was using...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/1099aca5eab352c2bcf9037d6753f6c81abddbb4.png)

Got to go to bed, but I'm wondering if contextStorage only works on global variables. The data I'm testing is in flow variables...

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 November 2020 08:16 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/36 "2020-11-21T08:16:24Z")

</div>

> [@alex88](#):
>
> I'm wondering if contextStorage only works on global variables

By that do you mean that it is working for you with global but not for flow?

Stop node red and start it again in a terminal. It shows the context store(s) in operation in the startup log.

If that is not showing the localfilesystem then did you edit the correct settings file? It tells you which one it is using in the startup log.

---

<div class="post-metadata">

**Author:** ![alex88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/alex88/32/55523_2.png) [@alex88](https://discourse.nodered.org/u/alex88)\
**Post date:** [21 November 2020 09:52 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/37 "2020-11-21T09:52:28Z")

</div>

Thanks. I'll test that.

I have not confirmed that it works for globals. It was a late night thought.

---

<div class="post-metadata">

**Author:** ![alex88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/alex88/32/55523_2.png) [@alex88](https://discourse.nodered.org/u/alex88)\
**Post date:** [21 November 2020 10:09 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/38 "2020-11-21T10:09:04Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/d/4d422da450f75b79757a690d20b57ad0614e8e90.png)

I can't see what it tells me that I don't already know.... Context Store is the localfilesystem as per the lines I uncommented in the settings.js file.

Can you think of any other tests that I can perform?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 November 2020 10:26 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/39 "2020-11-21T10:26:00Z")

</div>

so is there anything now in the `c:\users\ubuquitous\.node-red\context` directory ?  
(simple flow below just in case you need one to write something)

```auto
[{"id":"474a7c88.3a0434","type":"inject","z":"3e6448b5.f21398","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":1000,"wires":[["e1f097d2.8ce758"]]},{"id":"e1f097d2.8ce758","type":"function","z":"3e6448b5.f21398","name":"","func":"flow.set(\"flowfoo\",\"flowbar\");\nglobal.set(\"globalfoo\",\"globalbar\");\ncontext.set(\"nodefoo\",\"nodebar\")\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":380,"y":1000,"wires":[[]]}]

```

---

<div class="post-metadata">

**Author:** ![alex88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/alex88/32/55523_2.png) [@alex88](https://discourse.nodered.org/u/alex88)\
**Post date:** [21 November 2020 10:51 UTC](https://discourse.nodered.org/t/node-red-wont-start/33762/40 "2020-11-21T10:51:45Z")

</div>

yes, there are files and they seem to have current timestamps...

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

I feel like I must be doing something stoopid here, as it worked before and now it doesn't.

I'll check your flow now @dceejay

[Previous page](https://discourse.nodered.org/t/node-red-wont-start/33762.md?page=1)

[Next page](https://discourse.nodered.org/t/node-red-wont-start/33762.md?page=3)
