# Node-RED crash.es due to zlib error

**URL:** <https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008>\
**Category:** General\
**Created:** [26 June 2020 02:36 UTC](https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008 "2020-06-26T02:36:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![RogerioCassares](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@RogerioCassares](https://discourse.nodered.org/u/RogerioCassares)\
**Post date:** [26 June 2020 02:36 UTC](https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008/1 "2020-06-26T02:36:25Z")

</div>

Hi all!

For some reason i cannot know why, my node-red instance crashes untipically an the only error i can see at logs are:

24 Jun 04:22:13 - [red] Uncaught Exception:  
24 Jun 04:22:13 - TypeError: Cannot read property 'write' of null  
at Zlib.callback (zlib.js:499:33)

Please, I have no idea why and the new logs when I started again are normal. There no more infos about it.

What it could be, please?

Thank you all!

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [26 June 2020 05:32 UTC](https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008/2 "2020-06-26T05:32:07Z")

</div>

Did node-red function properly before ?  
If not, which node and npm versions and node-red version are you using ?  
If yes, did you install a new node recently ?

---

<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:** [26 June 2020 08:21 UTC](https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008/3 "2020-06-26T08:21:54Z")

</div>

Google suggests this may be an old nodejs issue, so, as @bakman2 suggests tell us the versions of everything and tell us what OS/hardware you are running on please.  
You can get the nodejs version using  
`node -v`  
but possibly even better would be to show us the startup log you get when starting node-red. That is the log starting with the Welcome to node red message.

---

<div class="post-metadata">

**Author:** ![RogerioCassares](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@RogerioCassares](https://discourse.nodered.org/u/RogerioCassares)\
**Post date:** [26 June 2020 12:42 UTC](https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008/4 "2020-06-26T12:42:59Z")

</div>

Hey there @bakman2 and @Colin!

Thanks!

`node -v`  
_v8.16.0_

`npm -v`  
_6.4.1_

**Node-RED start Log:**

> Node-RED service stop: Thu Jun 25 14:40:22 -03 2020
> 
> Node-RED service start: Thu Jun 25 14:40:22 -03 2020  
> 25 Jun 14:40:23 - [info]
> 
> # Welcome to Node-RED
> 
> 25 Jun 14:40:23 - [info] Node-RED version: v0.17.5  
> 25 Jun 14:40:23 - [info] Node.js version: v8.16.0  
> 25 Jun 14:40:23 - [info] Linux 4.4.0-178-generic x64 LE  
> 25 Jun 14:40:23 - [info] Loading palette nodes  
> { Error: Cannot find module '../build/Release/bson'  
> at Function.Module.\_resolveFilename (module.js:548:15)  
> at Function.Module.\_load (module.js:475:25)  
> at Module.require (module.js:597:17)  
> at require (internal/module.js:11:18)  
> at Object. (/home/smartcampus/.node-red/node\_modules/bson/ext/index.js:15:10)  
> at Module.\_compile (module.js:653:30)  
> at Object.Module.\_extensions..js (module.js:664:10)  
> at Module.load (module.js:566:32)  
> at tryModuleLoad (module.js:506:12)  
> at Function.Module.\_load (module.js:498:3) code: 'MODULE\_NOT\_FOUND' }  
> 25 Jun 14:40:26 - [warn] [mosca in] Deprecated call to RED.runtime.nodes.registerType - node-set name must be provided as first argument  
> 25 Jun 14:40:26 - [info] Dashboard version 2.19.4 started at /ui  
> 25 Jun 14:40:27 - [warn] ------------------------------------------------------  
> 25 Jun 14:40:27 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node  
> 25 Jun 14:40:27 - [warn] ------------------------------------------------------  
> 25 Jun 14:40:27 - [info] Settings file : /home/smartcampus/.node-red/settings.js  
> 25 Jun 14:40:27 - [info] User directory : /home/smartcampus/.node-red  
> 25 Jun 14:40:27 - [info] Flows file : /home/smartcampus/.node-red/flows\_smartcampus2017.json  
> 25 Jun 14:40:27 - [info] Server now running at [https://127.0.0.1:1880/](https://127.0.0.1:1880/)  
> 25 Jun 14:40:27 - [info] Starting flows  
> 25 Jun 14:40:29 - [info] [udp in:1907e2fa.4e6ded] udp listener at 0.0.0.0:2000  
> 25 Jun 14:40:29 - [info] [tcp in:fdd631fe.3541e] listening on port 3000  
> 25 Jun 14:40:29 - [info] [tcp in:66859c7c.10c7c4] listening on port 3100  
> 25 Jun 14:40:29 - [info] [tcp in:7674bac8.c40334] listening on port 3300  
> 25 Jun 14:40:29 - [info] [udp in:bb409157.a83e7] udp listener at 0.0.0.0:2100  
> 25 Jun 14:40:29 - [info] [udp in:55b9191.da5dde8] udp listener at 0.0.0.0:2200  
> 25 Jun 14:40:29 - [info] [udp in:b726bc12.c4a0f] udp listener at 0.0.0.0:2300  
> 25 Jun 14:40:29 - [error] [json:cacff221.e572e8] Unexpected token s in JSON at position 0  
> 25 Jun 14:40:29 - [info] [mqtt-broker:8bf3a4a0.9adb4] Connected to broker: mqtt://\<HOST\_NOT\_SHOWN\>:1883  
> 25 Jun 14:40:29 - [info] [mqtt-broker:774b558c.e52fbc] Connected to broker: mqtt://\<HOST\_NOT\_SHOWN\>:1883  
> 25 Jun 14:40:29 - [info] [mqtt-broker:c78b6667.8f2ab] Connected to broker: tccOrgaos@mqtt://\<HOST\_NOT\_SHOWN\>:1883  
> 25 Jun 14:40:29 - [info] [mqtt-broker:6b6fd295.b2d77c] Connected to broker: mqtt://\<HOST\_NOT\_SHOWN\>:1883  
> 25 Jun 14:40:29 - [info] [mqtt-broker:921ad3b8.77ee8] Connected to broker: edclaudio@mqtt://\<HOST\_NOT\_SHOWN\>:1883  
> 25 Jun 14:40:29 - [info] [mqtt-broker:1e511942.bf7247] Connected to broker: mqtt://\<HOST\_NOT\_SHOWN\>:1883  
> 25 Jun 14:40:29 - [info] [mqtt-broker:5b6bbc5a.91a354] Connected to broker: tcccivil@mqtt://\<HOST\_NOT\_SHOWN\>:1883  
> 25 Jun 14:40:29 - [info] [mqtt-broker:c7a7f08d.0b1] Connected to broker: fernando@mqtt://\<HOST\_NOT\_SHOWN\>:1883  
> 25 Jun 14:40:29 - [info] [mqtt-broker:171149.fafddeb7] Connected to broker: tccSplit2018@mqtt://\<HOST\_NOT\_SHOWN\>:1883  
> ...

I have updated `node-red-dashboard` for about 2 month ago to the latest fot that time: `v2.19.4`

Maybe it helps 🙂

---

<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:** [26 June 2020 13:18 UTC](https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008/5 "2020-06-26T13:18:18Z")

</div>

Well you have a couple of errors there that I would sort out first, in case the crash is a side effect of one of those.

> [@RogerioCassares](#):
>
> at Object. (/home/smartcampus/.node-red/node\_modules/bson/ext/index.js:15:10)

Do you know what is using the bson module? I don't think it is one of the standard modules included. If you don't know then first look in package.json and see if it is mentioned there. If not then look in package-lock.json, where you should be able to work out which node-red node include it.

> [@RogerioCassares](#):
>
> 25 Jun 14:40:29 - [error] [json:cacff221.e572e8] Unexpected token s in JSON at position 0

That is an error in a JSON node complaining about the data it is being passed. You can find the node in the node-red editor by using the Search feature and searching for the node id which is cacff221.e572e8

Next I would make sure that all the nodes you use are up to date, you can see in Manage Palette the nodes that can be updated.

If after all that it is still failing then I think I would upgrade nodejs to version 12.x

---

<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:** [26 June 2020 13:35 UTC](https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008/6 "2020-06-26T13:35:00Z")

</div>

> [@Colin](#):
>
> nodejs to version 12.x

Not sure Node-RED version: v0.17.5 will work with nodejs V12 (could be wrong - but I seem to remember issues of using nodejs v12 with older versions of node-red)

---

<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:** [26 June 2020 13:57 UTC](https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008/7 "2020-06-26T13:57:45Z")

</div>

Indeed - should be no need to change node.js version (yet) - that will possibly confuse things further.... I do notice however that one of the errors refers to mosca... if this is being used as an mqtt broker then indeed it may be cleaner and more reliable to use the separate mosquitto broker package and keep that outside of Node-RED and remove that dependency.

---

<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:** [26 June 2020 14:17 UTC](https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008/8 "2020-06-26T14:17:32Z")

</div>

Good point, hopefully the things I have suggested to do first will sort it anyway.

---

<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:** [25 August 2020 14:17 UTC](https://discourse.nodered.org/t/node-red-crash-es-due-to-zlib-error/29008/9 "2020-08-25T14:17:37Z")

</div>

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