# Node-red-mcu-plugin error when reinstalling

**URL:** <https://discourse.nodered.org/t/node-red-mcu-plugin-error-when-reinstalling/77021>\
**Category:** General\
**Created:** [28 March 2023 13:08 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-error-when-reinstalling/77021 "2023-03-28T13:08:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frida](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/frida/32/68250_2.png) [@Frida](https://discourse.nodered.org/u/Frida)\
**Post date:** [28 March 2023 13:08 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-error-when-reinstalling/77021/1 "2023-03-28T13:08:59Z")

</div>

After reinstalling node-red and @ralphwetzel/node-red-mcu-plugin, I've encountered these issues:  
1: After first start of node-red this error came, see pic01  
2: I removed the =, and tried again.  
3: After second start of node-red this error came, see pic02  
4: I removed the =, and tried again.  
5: After the third start everything was normal.  
But it didn't install @moddable-node-red, shouldn't it anymore?

When I tried a previous flow which worked before fresh install, this error comes, see pic03.

How do I proceed?

 ![pic01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/8/18c124fcbf3c34b40bba0caf7fe279843daeed00.jpeg)

 ![pic02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cfe10db2e60c4a853d570f4ed3d720cd82f576ca.jpeg)

 ![pic03](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/5/b5820f289aa4eca698a206523b3c3f5da685100b.png)

---

<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:** [28 March 2023 15:24 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-error-when-reinstalling/77021/2 "2023-03-28T15:24:23Z")

</div>

I don't think `??=` works with nodejs 14. Upgrade to 18 and it should be ok.  
14 is out of support in a months time anyway.

---

<div class="post-metadata">

**Author:** ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)\
**Post date:** [28 March 2023 16:13 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-error-when-reinstalling/77021/3 "2023-03-28T16:13:48Z")

</div>

> [@Frida](#):
>
> 5: After the third start everything was normal.

You're facing this issue - as @Colin stated - due to the `node.js` version you're using.  
`??=` is only supported by `node.js` \>= v15.0.0 ... a fact that I tend to ignore continuously. Sorry for that.

By removing the `=` you yet change the code significantly ... thus it breaks with the error you see in pic#03.

I'll provide a fix for that later today ... so it should work again with your environment.  
Sorry for the inconvenience...

---

<div class="post-metadata">

**Author:** ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)\
**Post date:** [28 March 2023 18:23 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-error-when-reinstalling/77021/4 "2023-03-28T18:23:16Z")

</div>

@Frida

> [@Frida](#):
>
> How do I proceed?

I've published a v1.3.1 of the plugin - which should be visible in the Node-RED "Manage Pallette" sidebar option in a few minutes.  
In this version, the two issues you found are reverted to a syntax that Node.js v14 understands.

---

<div class="post-metadata">

**Author:** ![Frida](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/frida/32/68250_2.png) [@Frida](https://discourse.nodered.org/u/Frida)\
**Post date:** [28 March 2023 19:02 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-error-when-reinstalling/77021/5 "2023-03-28T19:02:10Z")

</div>

In the meantime I have updated to node 18 now. My simple program with a switch and an LED seems a bit sluggish.  
When I press it, sometimes it responds immediately, and other times after some time.

---

<div class="post-metadata">

**Author:** ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)\
**Post date:** [28 March 2023 19:09 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-error-when-reinstalling/77021/6 "2023-03-28T19:09:09Z")

</div>

> [@Frida](#):
>
> My simple program with a switch and an LED seems a bit sluggish.

If you want, you may post the flow data here & we'll check if we can support...

---

<div class="post-metadata">

**Author:** ![Frida](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/frida/32/68250_2.png) [@Frida](https://discourse.nodered.org/u/Frida)\
**Post date:** [28 March 2023 19:27 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-error-when-reinstalling/77021/7 "2023-03-28T19:27:36Z")

</div>

```auto
[{"id":"d9a245d0e497656f","type":"tab","label":"mcuPicoW","disabled":false,"info":"","env":[],"_mcu":{"mcu":true}},{"id":"dfe6ab2a51eadbe3","type":"mcu_digital_out","z":"d9a245d0e497656f","name":"Led intern","pin":"32","mode":"Output","initial":"undefined","invert":false,"_mcu":{"mcu":true},"x":690,"y":320,"wires":[]},{"id":"1ba0c84fb0b955e8","type":"comment","z":"d9a245d0e497656f","name":"RPI PicoW","info":"","_mcu":{"mcu":true},"x":430,"y":160,"wires":[]},{"id":"edf91f47eec298d2","type":"mcu_digital_out","z":"d9a245d0e497656f","name":"aRelæ","pin":"26","mode":"Output","initial":"1","_mcu":{"mcu":true},"x":700,"y":200,"wires":[]},{"id":"a935b95bf957dd0b","type":"mcu_digital_out","z":"d9a245d0e497656f","name":"bRelæ","pin":"27","mode":"Output","initial":"1","_mcu":{"mcu":true},"x":700,"y":260,"wires":[]},{"id":"07dcd8fa76ab184e","type":"function","z":"d9a245d0e497656f","name":"Togur","func":"let msg3 = {}\n\nlet invar = msg.payload\n\nif(invar == 0) {\n msg3.payload = 1\n node.send([null, null, msg3])\n //setTimeout(() => {\n // msg3.payload = 0\n // node.send([null, null, msg3])\n //},200)\n} else {\n msg3.payload = 0\n node.send([null, null, msg3])\n}\n","outputs":3,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\n\nlet msg1 = {}\nlet msg2 = {}\n\nsetInterval(() => {\n let me = context.get('me') ?? 1\n \n if (me) {\n msg1.payload = 1\n node.send(msg1)\n setTimeout(() => {\n msg1.payload = 0\n node.send(msg1)\n }, 200)\n } else {\n msg2.payload = 1\n node.send([null, msg2])\n setTimeout(() => {\n msg2.payload = 0\n node.send([null, msg2])\n }, 200)\n }\n\n me = me ^ 1\n context.set('me', me)\n}, 5000)\n","finalize":"","libs":[],"_mcu":{"mcu":true},"x":430,"y":260,"wires":[["edf91f47eec298d2"],["a935b95bf957dd0b"],["dfe6ab2a51eadbe3"]]},{"id":"cdff39dbe8d5e1e2","type":"mcu_digital_in","z":"d9a245d0e497656f","name":"Push","pin":"1","mode":"InputPullUp","edge":"1","debounce":"10","initial":true,"_mcu":{"mcu":true},"x":190,"y":260,"wires":[["07dcd8fa76ab184e"]]},{"id":"9e3a7bd8f2970ddb","type":"comment","z":"d9a245d0e497656f","name":"Aktiv lav","info":"","_mcu":{"mcu":true},"x":200,"y":220,"wires":[]}]

```

 ![pic04](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/7/377c6c8759602b0282ce34c7a524edf127410701.png)

---

<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 May 2023 19:27 UTC](https://discourse.nodered.org/t/node-red-mcu-plugin-error-when-reinstalling/77021/8 "2023-05-27T19:27:51Z")

</div>

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