# Serial port connection error after deploy

**URL:** <https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561>\
**Category:** General\
**Tags:** function-node\
**Created:** [14 August 2023 14:13 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561 "2023-08-14T14:13:07Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Webastian](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/webastian/32/82027_2.png) [@Webastian](https://discourse.nodered.org/u/Webastian)\
**Post date:** [14 August 2023 14:13 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561/1 "2023-08-14T14:13:07Z")

</div>

Hi guys,

I am using Node-Red v3.0.2, Node.js v20.5.1 and node-red-node-serialport 1.0.4.

When I start Node-Red the connection works fine. As soon as I deploy Node-Red it tries to re-establish the serial connection. But this fails on every deploy because the port is supposedly not available. When I restart Node Red everything works as it should. It seems that Node Red is blocking the connection and cannot re-establish it. Does anyone have a solution to this problem?

```auto
*Welcome to Node-RED*
*===================*

*14 Aug 14:05:39 - [info] Node-RED version: v3.0.2*
*14 Aug 14:05:39 - [info] Node.js version: v20.5.1*
*14 Aug 14:05:39 - [info] Linux 5.15.0-78-generic x64 LE*
*14 Aug 14:05:39 - [info] Loading palette nodes*
*14 Aug 14:05:40 - [info] Dashboard version 3.5.0 started at /ui*
*14 Aug 14:05:40 - [info] Settings file : /home/app/.node-red/settings.js*
*14 Aug 14:05:40 - [info] Context store : 'default' [module=memory]*
*14 Aug 14:05:40 - [info] User directory : /home/app/.node-red*
*14 Aug 14:05:40 - [info] Projects directory: /home/app/.node-red/projects*
*14 Aug 14:05:40 - [info] Server now running at http://127.0.0.1:1880/admin/*
*14 Aug 14:05:40 - [info] Active project : Meilhaus_Steuerung*
*14 Aug 14:05:40 - [info] Flows file : /home/app/.node-red/projects/Meilhaus_Steuerung/flows.json*
*14 Aug 14:05:40 - [warn] Using unencrypted credentials*
*14 Aug 14:05:40 - [info] Starting flows*
*14 Aug 14:05:40 - [info] Started flows*
***14 Aug 14:05:40 - [info] [serialconfig:f1697cd44ae12613] serial port /dev/ttyUSB0 opened at 9600 baud 8N1***
***14 Aug 14:06:01 - [info] Stopping flows***
***14 Aug 14:06:01 - [info] serial port /dev/ttyUSB0 closed***
*14 Aug 14:06:01 - [info] Stopped flows*
*14 Aug 14:06:01 - [info] Updated flows*
*14 Aug 14:06:01 - [info] Starting flows*
*14 Aug 14:06:01 - [info] Started flows*
***14 Aug 14:06:01 - [error] [serialconfig:f1697cd44ae12613] serial port /dev/ttyUSB0 error: Error: Error Resource temporarily unavailable Cannot lock port***
*^C14 Aug 14:06:11 - [info] Stopping flows*
*14 Aug 14:06:11 - [info] serial port /dev/ttyUSB0 closed*
*14 Aug 14:06:11 - [info] Stopped flows*
*app@evndlegkk:~$ node-red* **(RESTART)**
*14 Aug 14:06:14 - [info]*

*Welcome to Node-RED*
*===================*

*14 Aug 14:06:14 - [info] Node-RED version: v3.0.2*
*14 Aug 14:06:14 - [info] Node.js version: v20.5.1*
*14 Aug 14:06:14 - [info] Linux 5.15.0-78-generic x64 LE*
*14 Aug 14:06:15 - [info] Loading palette nodes*
*14 Aug 14:06:15 - [info] Dashboard version 3.5.0 started at /ui*
*14 Aug 14:06:15 - [info] Settings file : /home/app/.node-red/settings.js*
*14 Aug 14:06:15 - [info] Context store : 'default' [module=memory]*
*14 Aug 14:06:15 - [info] User directory : /home/app/.node-red*
*14 Aug 14:06:15 - [info] Projects directory: /home/app/.node-red/projects*
*14 Aug 14:06:15 - [info] Server now running at http://127.0.0.1:1880/admin/*
*14 Aug 14:06:15 - [info] Active project : Meilhaus_Steuerung*
*14 Aug 14:06:15 - [info] Flows file : /home/app/.node-red/projects/Meilhaus_Steuerung/flows.json*
*14 Aug 14:06:15 - [warn] Using unencrypted credentials*
*14 Aug 14:06:15 - [info] Starting flows*
*14 Aug 14:06:15 - [info] Started flows*
***14 Aug 14:06:15 - [info] [serialconfig:f1697cd44ae12613] serial port /dev/ttyUSB0 opened at 9600 baud 8N1***

```

Best regards  
Sebastian

---

<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:** [14 August 2023 14:36 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561/2 "2023-08-14T14:36:44Z")

</div>

Welcome to the forum @Webastian.

I don't know what is causing the issue, but if you click the dropdown arrow on the Deploy button you can tell it to only deploy modified nodes, then when you deploy it will not restart the serial port so you should not see the issue. Also it will deploy much quicker.

---

<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:** [14 August 2023 14:40 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561/3 "2023-08-14T14:40:13Z")

</div>

I notice you are using nodejs20. We don’t recommend that just yet as often packages may not be updated to be fully compatible.

---

<div class="post-metadata">

**Author:** ![Webastian](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/webastian/32/82027_2.png) [@Webastian](https://discourse.nodered.org/u/Webastian)\
**Post date:** [15 August 2023 06:50 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561/4 "2023-08-15T06:50:35Z")

</div>

Many thanks Colin, even if this is not the complete solution, it is extremely practical and brings me a bit further. And you are right. If I deploy only the changed nodes, there is no issue.

---

<div class="post-metadata">

**Author:** ![Webastian](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/webastian/32/82027_2.png) [@Webastian](https://discourse.nodered.org/u/Webastian)\
**Post date:** [15 August 2023 06:52 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561/5 "2023-08-15T06:52:18Z")

</div>

Thanks dceejay. That is a good hint. I will try to downgrade Node.js

---

<div class="post-metadata">

**Author:** ![Webastian](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/webastian/32/82027_2.png) [@Webastian](https://discourse.nodered.org/u/Webastian)\
**Post date:** [15 August 2023 07:20 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561/6 "2023-08-15T07:20:23Z")

</div>

> [@dceejay](#):
>
> I notice you are using nodejs20. We don’t recommend that just yet as often packages may not be updated to be fully compatible.

That was the solution. Thank you very much.

---

<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:** [15 August 2023 09:37 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561/7 "2023-08-15T09:37:55Z")

</div>

Could you submit an issue please at [Issues · node-red/node-red · GitHub](https://github.com/node-red/node-red/issues). I expect the developers will want to fix it as nodejs 20 will be supported soon (I expect).

---

<div class="post-metadata">

**Author:** ![Webastian](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/webastian/32/82027_2.png) [@Webastian](https://discourse.nodered.org/u/Webastian)\
**Post date:** [15 August 2023 10:10 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561/8 "2023-08-15T10:10:26Z")

</div>

> [@Colin](#):
>
> Could you submit an issue please at [Issues · node-red/node-red · GitHub](https://github.com/node-red/node-red/issues). I expect the developers will want to fix it as nodejs 20 will be supported soon (I expect).

There it is: [Serial port connection error after deploy with Node.js v20.5.1 and node-red-node-serialport 1.0.4. · Issue #1028 · node-red/node-red-nodes · GitHub](https://github.com/node-red/node-red/issues/4277)

---

<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:** [15 August 2023 10:25 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561/9 "2023-08-15T10:25:53Z")

</div>

Great, thanks.

---

<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:** [29 August 2023 10:26 UTC](https://discourse.nodered.org/t/serial-port-connection-error-after-deploy/80561/10 "2023-08-29T10:26:13Z")

</div>

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