# Installation of node-red-contrib-modbus fails

**URL:** <https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873>\
**Category:** General\
**Created:** [22 December 2020 11:20 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873 "2020-12-22T11:20:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcs](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@jcs](https://discourse.nodered.org/u/jcs)\
**Post date:** [22 December 2020 11:20 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873/1 "2020-12-22T11:20:55Z")

</div>

Hi everyone,

On July'20, I installed for a first time the nodeRED, and the node-red-contrib-modbus module in a win10 PC. I deployed a flow in order to read a modbus variable with a USB-RS485 converter. Everything worked fine.

Now, in december'20, I uninstall nodeRED, and install again. Once installed, I could not open the localhost:1880

I attach the window returned in the reinstallingNodeRed.png file.

I read in the forum, that I could know which modules are installed using the usr/lib/node.modules command.

I also attach the window returned after execute the node-red usr/lib/node-modules command.

What I didn't know was that executing this command, I would be able to open the localhost:1880 again, and indeed, I can view the flow I first generated on july.

I delete the nodes related to the node-red-contrib-modbus, and I try to install again, so I'm sure of taking the lastest version (5.13.3 - 6 months ago). I attach the faill message.

I do not remember which versions I installed first, on July, but it was the last version at that time. Rigth now, I'm using the nodeRED v1.2.6, and the Node.js v14.15.2.

What am I doing wrong? How can I add a modbus module again?

Any help would be appreciated.

Thanks in advance,

Jaume Cañas

 ![contribModbusFails](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cf561cb1226c8ecd5f8af541119dd91504a3ca09.png) ![nodeRedListModules](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/4/84f80868633e45f98c34c99bfb8871530402876d.png) ![reinstallingNodeRed](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0b76670fab69eda32bc17fcd5bd81dde1d832306.png)

---

<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:** [22 December 2020 12:52 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873/2 "2020-12-22T12:52:42Z")

</div>

As you have upgraded nodejs since the serial port was compiled, you need to rebuild.

There are many ways to do this (npm rebuild, or delete offending node and do another npm install etc) but there may be more isues.

My suggestion would be...

1. stop node-red
2. Delete `node_modules` folder from ./node-red (make a backup first if you are concerned)
3. delete `package_lock.json` from .node-red folder (DO NOT delete package.json)
4. open a command window.
  1. `cd c:\users\Enginyer2\.node-red`
  2. `npm install`

If it fails, install _[windows build tools](https://www.npmjs.com/package/windows-build-tools)_ and try again.

lastly, it might also be worth re-installing .node-red (as some of its own node\_modules might be out of date - but worry about this later)

* * *

PS, make a backup of your flow files if you havent. They should be fine but best to avoid any slips.

---

<div class="post-metadata">

**Author:** ![jcs](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@jcs](https://discourse.nodered.org/u/jcs)\
**Post date:** [23 December 2020 08:57 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873/3 "2020-12-23T08:57:06Z")

</div>

Hi Steve,

How can I delete node-modules? If I type it in the node.js prompt, either in the cmd, it says that delete is not recognized as an internal nor external command.

Thanks in advance,

Jaume

---

<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:** [23 December 2020 09:28 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873/4 "2020-12-23T09:28:19Z")

</div>

Just Delete `node_modules` folder as you would any other folder. Follow steps 1 to 4 as I wrote.

---

<div class="post-metadata">

**Author:** ![jcs](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@jcs](https://discourse.nodered.org/u/jcs)\
**Post date:** [23 December 2020 16:19 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873/5 "2020-12-23T16:19:50Z")

</div>

Hi Steve,

I didn't think that you refer to a hard disk folder in the PC, sorry. I thougth it were virtual folders.

Anyway, I don't have a package\_lock.json file in the .node-red folder.

Excuse my ignorance, but the node-red folder is that called nodejs?

c:\Program Files\nodejs\node\_modules\npm\node\_modules  
The package.json file hangs up of the npm folder. When you ask me to delete the node\_modules folder, I understand that you refer to this last folder, don't you?

I've tried it. (The 4 steps you suggest, installing the windows build tools, and also re-installing node-red) and I don't succed!

One strange thing it's happenning: When I load the localhost:1880, the flow stops due to a missing node type (as shown in the attached file)

 ![FlowStoppedMissingNodeTypes](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/73550a524e6641f9db160eb6ac3e46d5014c28cc.png) I've deleted every modbus node in the flow. How is it possible that miss a node type that is not in the flow?

Thank you for your time.

Jaume Cañas

---

<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:** [23 December 2020 16:22 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873/6 "2020-12-23T16:22:40Z")

</div>

> [@jcs](#):
>
> I've deleted every modbus node in the flow. How is it possible that miss a node type that is not in the flow?

Did you check config nodes?

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

Did you try search CTRL+F

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

---

<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:** [23 December 2020 16:26 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873/7 "2020-12-23T16:26:17Z")

</div>

> [@jcs](#):
>
> Anyway, I don't have a package\_lock.json file in the .node-red folder.

How do you know if you cannot find .node-red folder?...

> [@jcs](#):
>
> Excuse my ignorance, but the node-red folder is that called nodejs

No, it is called `.node-red` and it is in the screenshot you posted...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/94fa00daf9db0289f106c04773fc13c831925b6f.jpeg)

and i said so above in STEP 4 "c:\users\Enginyer2.node-red"...

> [@jcs](#):
>
> c:\Program Files\nodejs\node\_modules\npm\node\_modules  
> The package.json file hangs up of the npm folder. When you ask me to delete the node\_modules folder, I understand that you refer to this last folder, don't you?

No, I said `node_modules` inside `./node-red`

> [@jcs](#):
>
> I've tried it. (The 4 steps you suggest, installing the windows build tools, and also re-installing node-red) and I don't succed!

What was the outcome? It takes quite some time to finish.

---

<div class="post-metadata">

**Author:** ![jcs](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@jcs](https://discourse.nodered.org/u/jcs)\
**Post date:** [24 December 2020 11:04 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873/8 "2020-12-24T11:04:03Z")

</div>

Hi Steve,

I have tried it again:

Installing the windows build tools with administrative rights...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bdddcf5283ac2c20bb3310c065f6a62e6720673e.png)

and then executing

'npm install -g node-red-contrib.modbus --unsafe-perm --build-from-source'

...I have been able to load the flow again.

Thank you very much!

Best regards,

Jaume Cañas

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [24 December 2020 12:21 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873/9 "2020-12-24T12:21:48Z")

</div>

> [@jcs](#):
>
> node-red-contrib.modbus

There's a typo in case someone reads it in the future.  
it should be `node-red-contrib-modbus`  
and i doubt if there is reason to install it globally -g

---

<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:** [7 January 2021 12:21 UTC](https://discourse.nodered.org/t/installation-of-node-red-contrib-modbus-fails/37873/10 "2021-01-07T12:21:58Z")

</div>

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