# TypeError: Cannot set properties of undefined (setting 'mode')

**URL:** <https://discourse.nodered.org/t/typeerror-cannot-set-properties-of-undefined-setting-mode/71345>\
**Category:** General\
**Created:** [28 November 2022 01:40 UTC](https://discourse.nodered.org/t/typeerror-cannot-set-properties-of-undefined-setting-mode/71345 "2022-11-28T01:40:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NathanM](https://avatars.discourse-cdn.com/v4/letter/n/e274bd/32.png) [@NathanM](https://discourse.nodered.org/u/NathanM)\
**Post date:** [28 November 2022 01:40 UTC](https://discourse.nodered.org/t/typeerror-cannot-set-properties-of-undefined-setting-mode/71345/1 "2022-11-28T01:40:50Z")

</div>

Hello, I keep running into this issue with node-red and I'm not sure on how to fix it. Any help would be greatly appreciated. I ran standardfirmataplus on my arduino/Teensy. Node-red worked earlier but when I started another project I get this error message on my command prompt

Node-RED version: v3.0.2  
Node.js version: v18.12.1  
\<  
27 Nov 20:32:36 - [warn] Encrypted credentials not found  
27 Nov 20:32:36 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)  
27 Nov 20:32:36 - [info] Starting flows  
27 Nov 20:32:36 - [info] Started flows  
27 Nov 20:32:41 - [red] Uncaught Exception:  
27 Nov 20:32:41 - [error] TypeError: Cannot set properties of undefined (setting 'mode')  
at Firmata.pinMode (C:\Users\MacDo.node-red\node\_modules\firmata-io\lib\firmata.js:945:44)  
at doit (C:\Users\MacDo.node-red\node\_modules\node-red-node-arduino\35-arduino.js:80:63)  
at Firmata. (C:\Users\MacDo.node-red\node\_modules\node-red-node-arduino\35-arduino.js:122:62)  
at Object.onceWrapper (node:events:627:28)  
at Firmata.emit (node:events:525:35)  
at Firmata.ready (C:\Users\MacDo.node-red\node\_modules\firmata-io\lib\firmata.js:733:13)  
at Object.onceWrapper (node:events:627:28)  
at Firmata.emit (node:events:513:28)  
at 106 (C:\Users\MacDo.node-red\node\_modules\firmata-io\lib\firmata.js:293:11)  
at SerialPort. (C:\Users\MacDo.node-red\node\_modules\firmata-io\lib\firmata.js:640:15)

C:\Users\MacDo\>  
/\>

---

<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:** [28 November 2022 10:41 UTC](https://discourse.nodered.org/t/typeerror-cannot-set-properties-of-undefined-setting-mode/71345/2 "2022-11-28T10:41:25Z")

</div>

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

You can edit and correct your post by clicking the pencil ✏ icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<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:** [28 November 2022 15:52 UTC](https://discourse.nodered.org/t/typeerror-cannot-set-properties-of-undefined-setting-mode/71345/3 "2022-11-28T15:52:37Z")

</div>

That is a bit odd... the code in question would occur is the board isn't ready - and yet line 122 is a callback from the "board ready" event... that then calls this code to set the mode... so something is telling porky pies... either it is saying it's ready before it really is... or it's going ready then failing so quick that it's no longer ready...

Can you try with Standard Firmata - not the plus version you mention ? (or can you send a pointer to the plus version you are using so we can give it a try...) Thankls

---

<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:** [27 January 2023 15:53 UTC](https://discourse.nodered.org/t/typeerror-cannot-set-properties-of-undefined-setting-mode/71345/4 "2023-01-27T15:53:20Z")

</div>

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