Modbus install(nore-red-contrib-modbus)

Hello, I've problem with Modbus. When I install node-red-contrib-modbus it show me red alert in Manage palette where I find all installed nodes. And when I use Modbus Flex Getter it doesn't work. I also send my flow to friend and it works on his PC, so I believe the problem is that red alert. I also reinstall it but it still show the red alert.

Is here someone who knows what's the problem?

node%20red%20modbus1

When you start Node-RED, what version of node-RED and nodejs does it report?
Also are there any errors reported?

Node Red version: 0.19.5
Node.js version: v6.10.3

When I try to use Modbus Flex Getter node I've got two errors

"SyntaxError: Unexpected token function"
"TypeError: Cannot read property 'registerForModbus' of null"

Any ideas what could be wrong or what should I do?

and what version of node-red-contrib-modbus have you installed?

You can check what version you have installed in the manage palette part of the node-red menu

node-red-contrib-modbus: 4.1.3
Is that a problem?

Please read the contrib-nodes readme https://flows.nodered.org/node/node-red-contrib-modbus

So when I have node.js v6.X I should install node-red-contrib-modbus v2.X ? Is that right?

Well personally I’d upgrade to Node-RED v0.20.x and therefore upgrade to nodejs v8 or v10 (first) and then install then correct version for that version of nodejs

Does someone know how to update Node-red on groov EPIC ?

Ask manufacturer)

Hi There, hope somebody can help me

-----------------------------------------------------------
2020-01-03T13:35:33.296Z Install : node-red-contrib-modbus 5.2.0

2020-01-03T13:35:33.326Z npm install --no-audit --no-update-notifier --save --save-prefix="~" --production node-red-contrib-modbus@5.2.0
2020-01-03T13:36:41.818Z [out] 
2020-01-03T13:36:41.818Z [out] > @serialport/bindings@8.0.6 install /home/admin/.node-red/node_modules/@serialport/bindings
2020-01-03T13:36:41.818Z [out] > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2020-01-03T13:36:41.818Z [out] 
2020-01-03T13:36:42.876Z [err] prebuild-install
2020-01-03T13:36:42.876Z [err]  WARN install No prebuilt binaries found (target=13.5.0 runtime=node arch=x64 libc= platform=linux)
2020-01-03T13:36:45.356Z [out] make: Entering directory '/home/admin/.node-red/node_modules/@serialport/bindings/build'
2020-01-03T13:36:45.360Z [out]   CXX(target) Release/obj.target/bindings/src/serialport.o
2020-01-03T13:36:52.734Z [out]   CXX(target) Release/obj.target/bindings/src/serialport_unix.o
2020-01-03T13:36:57.373Z [out]   CXX(target) Release/obj.target/bindings/src/poller.o
2020-01-03T13:37:02.609Z [out]   CXX(target) Release/obj.target/bindings/src/serialport_linux.o
2020-01-03T13:37:02.761Z [out]   SOLINK_MODULE(target) Release/obj.target/bindings.node
2020-01-03T13:37:03.382Z [out]   COPY Release/bindings.node
2020-01-03T13:37:03.404Z [out] make: Leaving directory '/home/admin/.node-red/node_modules/@serialport/bindings/build'
2020-01-03T13:37:03.433Z [out] 
2020-01-03T13:37:03.433Z [out] > @serialport/bindings@2.0.8 install /home/admin/.node-red/node_modules/modbus-serial/node_modules/@serialport/bindings
2020-01-03T13:37:03.433Z [out] > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2020-01-03T13:37:03.433Z [out] 
2020-01-03T13:37:05.033Z [err] prebuild-install
2020-01-03T13:37:05.033Z [err]  WARN install No prebuilt binaries found (target=13.5.0 runtime=node arch=x64 libc= platform=linux)
2020-01-03T13:37:06.917Z [out] make: Entering directory '/home/admin/.node-red/node_modules/modbus-serial/node_modules/@serialport/bindings/build'
2020-01-03T13:37:06.920Z [out]   CXX(target) Release/obj.target/bindings/src/serialport.o
2020-01-03T13:37:10.751Z [err] ../src/serialport.cpp: In function ‘void EIO_AfterGet(uv_work_t*)’:
2020-01-03T13:37:10.751Z [err] ../src/serialport.cpp:329:96: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::FactoryBase<v8::Boolean>::return_t)’
2020-01-03T13:37:10.751Z [err]      results->Set(Nan::New<v8::String>("cts").ToLocalChecked(), Nan::New<v8::Boolean>(data->cts));
2020-01-03T13:37:10.751Z [err]                                                                                                 ^
2020-01-03T13:37:10.752Z [err] In file included from /home/admin/.cache/node-gyp/13.5.0/include/node/node.h:63:0,
2020-01-03T13:37:10.752Z [err]                  from ../../../../../nan/nan.h:54,
2020-01-03T13:37:10.752Z [err]                  from ../src/./serialport.h:6,
2020-01-03T13:37:10.752Z [err]                  from ../src/serialport.cpp:1:
2020-01-03T13:37:10.752Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3547:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)
2020-01-03T13:37:10.752Z [err]    V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
2020-01-03T13:37:10.752Z [err]                                      ^
2020-01-03T13:37:10.752Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3547:37: note:   candidate expects 3 arguments, 2 provided
2020-01-03T13:37:10.752Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3550:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)
2020-01-03T13:37:10.752Z [err]    V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
2020-01-03T13:37:10.752Z [err]                                      ^
2020-01-03T13:37:10.752Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3550:37: note:   candidate expects 3 arguments, 2 provided
2020-01-03T13:37:10.759Z [err] ../src/serialport.cpp:330:96: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::FactoryBase<v8::Boolean>::return_t)’
2020-01-03T13:37:10.759Z [err]      results->Set(Nan::New<v8::String>("dsr").ToLocalChecked(), Nan::New<v8::Boolean>(data->dsr));
2020-01-03T13:37:10.759Z [err]                                                                                                 ^
2020-01-03T13:37:10.759Z [err] In file included from /home/admin/.cache/node-gyp/13.5.0/include/node/node.h:63:0,
2020-01-03T13:37:10.759Z [err]                  from ../../../../../nan/nan.h:54,
2020-01-03T13:37:10.759Z [err]                  from ../src/./serialport.h:6,
2020-01-03T13:37:10.759Z [err]                  from ../src/serialport.cpp:1:
2020-01-03T13:37:10.759Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3547:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)
2020-01-03T13:37:10.759Z [err]    V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
2020-01-03T13:37:10.759Z [err]                                      ^
2020-01-03T13:37:10.759Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3547:37: note:   candidate expects 3 arguments, 2 provided
2020-01-03T13:37:10.759Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3550:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)
2020-01-03T13:37:10.759Z [err]    V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
2020-01-03T13:37:10.759Z [err]                                      ^
2020-01-03T13:37:10.759Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3550:37: note:   candidate expects 3 arguments, 2 provided
2020-01-03T13:37:10.759Z [err] ../src/serialport.cpp:331:96: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::FactoryBase<v8::Boolean>::return_t)’
2020-01-03T13:37:10.759Z [err]      results->Set(Nan::New<v8::String>("dcd").ToLocalChecked(), Nan::New<v8::Boolean>(data->dcd));
2020-01-03T13:37:10.759Z [err]                                                                                                 ^
2020-01-03T13:37:10.759Z [err] In file included from /home/admin/.cache/node-gyp/13.5.0/include/node/node.h:63:0,
2020-01-03T13:37:10.759Z [err]                  from ../../../../../nan/nan.h:54,
2020-01-03T13:37:10.759Z [err]                  from ../src/./serialport.h:6,
2020-01-03T13:37:10.759Z [err]                  from ../src/serialport.cpp:1:
2020-01-03T13:37:10.759Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3547:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)
2020-01-03T13:37:10.759Z [err]    V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
2020-01-03T13:37:10.759Z [err]                                      ^
2020-01-03T13:37:10.759Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3547:37: note:   candidate expects 3 arguments, 2 provided
2020-01-03T13:37:10.759Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3550:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)
2020-01-03T13:37:10.759Z [err]    V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
2020-01-03T13:37:10.759Z [err]                                      ^
2020-01-03T13:37:10.759Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3550:37: note:   candidate expects 3 arguments, 2 provided
2020-01-03T13:37:10.775Z [err] ../src/serialport.cpp: In function ‘void EIO_AfterGetBaudRate(uv_work_t*)’:
2020-01-03T13:37:10.775Z [err] ../src/serialport.cpp:378:106: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’
2020-01-03T13:37:10.775Z [err]      results->Set(Nan::New<v8::String>("baudRate").ToLocalChecked(), Nan::New<v8::Integer>(data->baudRate));
2020-01-03T13:37:10.775Z [err]                                                                                                           ^
2020-01-03T13:37:10.775Z [err] In file included from /home/admin/.cache/node-gyp/13.5.0/include/node/node.h:63:0,
2020-01-03T13:37:10.775Z [err]                  from ../../../../../nan/nan.h:54,
2020-01-03T13:37:10.775Z [err]                  from ../src/./serialport.h:6,
2020-01-03T13:37:10.775Z [err]                  from ../src/serialport.cpp:1:
2020-01-03T13:37:10.775Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3547:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)
2020-01-03T13:37:10.775Z [err]    V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
2020-01-03T13:37:10.775Z [err]                                      ^
2020-01-03T13:37:10.775Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3547:37: note:   candidate expects 3 arguments, 2 provided
2020-01-03T13:37:10.775Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3550:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)
2020-01-03T13:37:10.775Z [err]    V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
2020-01-03T13:37:10.775Z [err]                                      ^
2020-01-03T13:37:10.775Z [err] /home/admin/.cache/node-gyp/13.5.0/include/node/v8.h:3550:37: note:   candidate expects 3 arguments, 2 provided
2020-01-03T13:37:11.256Z [out] bindings.target.mk:112: recipe for target 'Release/obj.target/bindings/src/serialport.o' failed
2020-01-03T13:37:11.256Z [out] make: Leaving directory '/home/admin/.node-red/node_modules/modbus-serial/node_modules/@serialport/bindings/build'
2020-01-03T13:37:11.257Z [err] make: *** [Release/obj.target/bindings/src/serialport.o] Error 1
2020-01-03T13:37:11.261Z [err] gyp
2020-01-03T13:37:11.262Z [err]  
2020-01-03T13:37:11.262Z [err] ERR! 
2020-01-03T13:37:11.262Z [err] build error
2020-01-03T13:37:11.272Z [err]  
2020-01-03T13:37:11.272Z [err] gyp ERR! stack Error: `make` failed with exit code: 2
2020-01-03T13:37:11.272Z [err] gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
2020-01-03T13:37:11.272Z [err] gyp ERR! stack     at ChildProcess.emit (events.js:305:20)
2020-01-03T13:37:11.272Z [err] gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
2020-01-03T13:37:11.273Z [err] gyp ERR! 
2020-01-03T13:37:11.273Z [err] System Linux 4.4.0-130-generic
2020-01-03T13:37:11.273Z [err] gyp 
2020-01-03T13:37:11.273Z [err] ERR! 
2020-01-03T13:37:11.273Z [err] command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2020-01-03T13:37:11.273Z [err] gyp 
2020-01-03T13:37:11.273Z [err] ERR!
2020-01-03T13:37:11.273Z [err]  cwd
2020-01-03T13:37:11.274Z [err]  /home/admin/.node-red/node_modules/modbus-serial/node_modules/@serialport/bindings
2020-01-03T13:37:11.274Z [err] gyp 
2020-01-03T13:37:11.274Z [err] ERR!
2020-01-03T13:37:11.274Z [err]  node -v
2020-01-03T13:37:11.274Z [err]  v13.5.0
2020-01-03T13:37:11.274Z [err] gyp 
2020-01-03T13:37:11.274Z [err] ERR!
2020-01-03T13:37:11.274Z [err]  node-gyp -v
2020-01-03T13:37:11.274Z [err]  v5.0.7
2020-01-03T13:37:11.274Z [err] gyp 
2020-01-03T13:37:11.275Z [err] ERR! 
2020-01-03T13:37:11.275Z [err] not ok 
2020-01-03T13:37:17.497Z [err] npm
2020-01-03T13:37:17.497Z [err]  WARN node-red-contrib-ui-led@0.3.1 requires a peer of node-red-dashboard@2.14.x but none is installed. You must install peer dependencies yourself.
2020-01-03T13:37:17.499Z [err] npm 
2020-01-03T13:37:17.499Z [err] WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
2020-01-03T13:37:17.499Z [err] npm 
2020-01-03T13:37:17.499Z [err] WARN 
2020-01-03T13:37:17.500Z [err] notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2020-01-03T13:37:17.501Z [err] 
2020-01-03T13:37:17.521Z [err] npm
2020-01-03T13:37:17.522Z [err]  
2020-01-03T13:37:17.522Z [err] ERR!
2020-01-03T13:37:17.522Z [err]  
2020-01-03T13:37:17.522Z [err] code
2020-01-03T13:37:17.523Z [err]  ELIFECYCLE
2020-01-03T13:37:17.523Z [err] npm
2020-01-03T13:37:17.523Z [err]  
2020-01-03T13:37:17.524Z [err] ERR!
2020-01-03T13:37:17.524Z [err]  
2020-01-03T13:37:17.524Z [err] errno
2020-01-03T13:37:17.524Z [err]  1
2020-01-03T13:37:17.525Z [err] npm
2020-01-03T13:37:17.525Z [err]  
2020-01-03T13:37:17.526Z [err] ERR!
2020-01-03T13:37:17.526Z [err]  @serialport/bindings@2.0.8 install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild`
2020-01-03T13:37:17.526Z [err] npm
2020-01-03T13:37:17.527Z [err]  
2020-01-03T13:37:17.527Z [err] ERR!
2020-01-03T13:37:17.527Z [err]  Exit status 1
2020-01-03T13:37:17.527Z [err] npm
2020-01-03T13:37:17.528Z [err]  
2020-01-03T13:37:17.528Z [err] ERR!
2020-01-03T13:37:17.528Z [err]  
2020-01-03T13:37:17.528Z [err] npm
2020-01-03T13:37:17.529Z [err]  
2020-01-03T13:37:17.529Z [err] ERR!
2020-01-03T13:37:17.529Z [err]  Failed at the @serialport/bindings@2.0.8 install script.
2020-01-03T13:37:17.529Z [err] npm
2020-01-03T13:37:17.530Z [err]  
2020-01-03T13:37:17.530Z [err] ERR!
2020-01-03T13:37:17.530Z [err]  This is probably not a problem with npm. There is likely additional logging output above.
2020-01-03T13:37:17.658Z [err] 
2020-01-03T13:37:17.658Z [err] npm ERR! A complete log of this run can be found in:
2020-01-03T13:37:17.658Z [err] npm 
2020-01-03T13:37:17.658Z [err] ERR!     /home/admin/.npm/_logs/2020-01-03T13_37_17_633Z-debug.log
2020-01-03T13:37:17.731Z rc=1

Hi @fjungen, it appears you are using an unsupported version of node.js (13.5.0). That may, or may not, be the problem. But I suggest you first install a supported version (preferably 10.x or 12.x). You should then re-install node-red and go to your .node-red folder and run
npm rebuild
to make sure everything already installed is rebuilt for the new version. Then try the serialport again.
If you have further problems please also tell us which version of node-red you are using and what operating system.

Thanks Colin, appreciate the fast response, below the versions I am using

3 Jan 15:28:08 - [info] Node-RED version: v1.0.3
3 Jan 15:28:08 - [info] Node.js  version: v13.5.0
3 Jan 15:28:08 - [info] Linux 4.4.0-130-generic x64 LE
3 Jan 15:28:09 - [info] Loading palette nodes
3 Jan 15:28:21 - [info] Dashboard version 2.19.3 started at /ui
3 Jan 15:28:21 - [info] Settings file  : /home/admin/.node-red/settings.js
3 Jan 15:28:21 - [info] Context store  : 'default' [module=memory]
3 Jan 15:28:21 - [info] User directory : /home/admin/.node-red
3 Jan 15:28:21 - [warn] Projects disabled : editorTheme.projects.enabled=false
3 Jan 15:28:21 - [info] Flows file     : /home/admin/.node-red/flows_ubuntu.json
3 Jan 15:28:21 - [error] Uncaught Exception:
3 Jan 15:28:21 - [error] Error: listen EADDRINUSE: address already in use 0.0.0.0:1880
    at Server.setupListenHandle [as _listen2] (net.js:1308:16)
    at listenInCluster (net.js:1356:12)
    at doListen (net.js:1495:7)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)

As far as I remember (there’s been multiple topics about this, use the forum search sorted on most recent) this specific node is currently unmaintained and doesn’t support any version above nodejs 8.

Thanks guys, downgrading to v12.14.0 worked !!

1 Like

Good afternoom, I want know if i can use two node modbus read in a the same flow with ModbuSim.

Welcome to the forum @oscarpedraza85

If ModbuSim is a modbus server simulator then the modbus nodes should work with it ok just as with a real modbus device.