# Update Node.js 12.22.12 to latest version question

**URL:** https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666
**Category:** General
**Created:** [20 August 2023 09:29 UTC](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666 "2023-08-20T09:29:09Z")
**Posts on this page:** 9
**Page:** 2

<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: [20 September 2023 20:46 UTC](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666/21 "2023-09-20T20:46:56Z")

</div>

So the problem is not that they are not being rotated, but the fact that they are growing to ridiculous sizes. Run  
tail -f /var/log/syslog  
and you will hopefully get a clue as to what the problem is.

---

<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 September 2023 20:54 UTC](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666/22 "2023-09-20T20:54:11Z")

</div>

Well my /var/log/daemon.log currently has 17725 lines in it (`wc -l /var/log/daemon.log`) of which 15167 contain "Node-RED" (`grep Node-RED /var/log/daemon.log | wc -l` )  
And, frankly I think my Node-red logging is out of control at 2MB.  
Yours is clearly unacceptable.

This command may be useful. It should list the node ids in the log, with the number of occurrences:

```auto
grep Node-RED /var/log/daemon.log | awk '{print $11}' | sort | uniq -c | sort -n

```

Ignoring anything with less than 100 incidences, I get this

```auto
    237 red/nodes/flows.start
    563 [exec:1bb8bcbf.633e63]
   2230 red/nodes/flows.stop
   5628 [exec:5986a4c350aaea76]
   5628 [exec:f9f419f7e7b8341b]

```

I have two nodes each having run 5600 times today. I can find these nodes and see what's going on. Is there a loop? Am I receiving data from MQTT faster than I expected? etc.

---

<div class="post-metadata">

### Author: ![gschmidt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gschmidt/32/60349_2.png) [@gschmidt](https://discourse.nodered.org/u/gschmidt)
#### Post date: [20 September 2023 20:55 UTC](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666/23 "2023-09-20T20:55:07Z")

</div>

I think I found the problem.

I also run a **node.js** script which I found on Github a few years ago to connect to my **Ziggo Next STB**  
This script is not updated to node.js 16  
See some of the errors below.....and this script is constantly heartbeating and fills rapidly the daemon and syslog log files

```auto
Sep 20 00:12:26 NodeRED-Pi Node-RED[373]: at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {
Sep 20 00:12:26 NodeRED-Pi Node-RED[373]: errno: -113,
Sep 20 00:12:26 NodeRED-Pi Node-RED[373]: code: 'EHOSTUNREACH',
Sep 20 00:12:26 NodeRED-Pi Node-RED[373]: syscall: 'connect',
Sep 20 00:12:26 NodeRED-Pi Node-RED[373]: address: '192.168.1.64',
Sep 20 00:12:26 NodeRED-Pi Node-RED[373]: port: 8009
Sep 20 00:12:26 NodeRED-Pi Node-RED[373]: }
Sep 20 00:12:26 NodeRED-Pi npm[13145]: /home/pi/Ziggo/NextRemoteJs/node_modules/axios/lib/core/createError.js:16
Sep 20 00:12:26 NodeRED-Pi npm[13145]: var error = new Error(message);
Sep 20 00:12:26 NodeRED-Pi npm[13145]: ^
Sep 20 00:12:26 NodeRED-Pi npm[13145]: Error: Request failed with status code 403
Sep 20 00:12:26 NodeRED-Pi npm[13145]: at createError (/home/pi/Ziggo/NextRemoteJs/node_modules/axios/lib/core/createError.js:16:15)
Sep 20 00:12:26 NodeRED-Pi npm[13145]: at settle (/home/pi/Ziggo/NextRemoteJs/node_modules/axios/lib/core/settle.js:17:12)
Sep 20 00:12:26 NodeRED-Pi npm[13145]: at IncomingMessage.handleStreamEnd (/home/pi/Ziggo/NextRemoteJs/node_modules/axios/lib/adapters/http.js:269:11)
Sep 20 00:12:26 NodeRED-Pi npm[13145]: at IncomingMessage.emit (node:events:525:35)
Sep 20 00:12:26 NodeRED-Pi npm[13145]: at endReadableNT (node:internal/streams/readable:1358:12)
Sep 20 00:12:26 NodeRED-Pi npm[13145]: at processTicksAndRejections (node:internal/process/task_queues:83:21) {

```

---

<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: [20 September 2023 21:02 UTC](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666/24 "2023-09-20T21:02:06Z")

</div>

With the frequency and amount of logs you have I would put money on there being a loop in your flows (or a terribly buggy node)

---

<div class="post-metadata">

### Author: ![gschmidt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gschmidt/32/60349_2.png) [@gschmidt](https://discourse.nodered.org/u/gschmidt)
#### Post date: [20 September 2023 21:17 UTC](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666/25 "2023-09-20T21:17:44Z")

</div>

> [@Steve-Mcl](#):
>
> With the frequency and amount of logs you have I would put money on there being a loop in your flows (or a terribly buggy node)

True....it is this node.js script: **/home/pi/Ziggo/NextRemoteJs/node\_modules**  
This script accesses the functions of my STB (Ziggo Next) over HTTP  
I installed this script a few years ago from Github  
Back then I also created a Node-Red flow which accesses only the ON/OFF functions of the script with a **http request** node

The creator has not updated the script to node.js v16  
This causes the constant loop of error messages I guess?

---

<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 September 2023 21:24 UTC](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666/26 "2023-09-20T21:24:47Z")

</div>

> [@gschmidt](#):
>
> I thought that after a reboot the log files would automatically be deleted?

There is a thing called logrotate going on. Logfiles are kept (for a week?), the oldest ones get deleted. All but the current and 1 previous files are compressed as .gz.  
It is all configurable but I'm not sure how, nor what the defaults are.

Writing huge log files to the root filesystem, especially on an SD card, is a significant issue for your Pi's lifespan.  
I use Log2ram to reduce log writes to the storage on my main Pi.

---

<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: [21 September 2023 14:21 UTC](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666/27 "2023-09-21T14:21:29Z")

</div>

> [@jbudd](#):
>
> Writing huge log files to the root filesystem, especially on an SD card, is a significant issue for your Pi's lifespan.  
> I use Log2ram to reduce log writes to the storage on my main Pi.

Never had any issues with Pi log files to sd-card during all the years I ran Pi's. A decent card with plenty of spare room and a card that does wear levelling (most do not, the Samsung Evo cards do) takes care of it all and the card will last years. Not as long as a disk or SSD of course but long enough given the cost.

And, putting the log files to RAM disk can cause other issues, especially in cases like this where a log file suddenly grows really big.

Interestingly, on my Debian server:

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

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

---

<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: [21 September 2023 18:37 UTC](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666/28 "2023-09-21T18:37:19Z")

</div>

> [@TotallyInformation](#):
>
> Interestingly, on my Debian server:
> 
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/efee6dd169cdec140f3d8054b3c9c4850b262711.png)

Well I can't explain that. Maybe you used the "Alternative installation script", maybe you changed the log level in settings.js.

> [@TotallyInformation](#):
>
> A decent card with plenty of spare room and a card that does wear levelling (most do not, the Samsung Evo cards do) takes care of it all and the card will last years.

Yes that's true. We don't know what size or make the OP's SD card is, but he clearly failed at the plenty of spare room step.

---

<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: [20 November 2023 18:37 UTC](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666/29 "2023-11-20T18:37:39Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/update-node-js-12-22-12-to-latest-version-question/80666.md?page=1)
