Installation of node-red-contrib-modbus fails

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

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 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.

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

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

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)

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

Did you check config nodes?

image

Did you try search CTRL+F

image

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

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

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

No, I said node_modules inside ./node-red

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

Hi Steve,

I have tried it again:

Installing the windows build tools with administrative rights...

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

1 Like

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

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