KerlinkGateway - Installation of node red

Hello,
I would like to install node-red on Kerlink iFemtoCell-evolution 868.
I managed to install node.js and npm manually but when I try to install node-red I receive errors like in code below.
Can anyone help me to solve this issue and tell me what is wrong?
Some informations about Linux installed on the gateway

Linux klk-fevo-03009F 4.14.9-klk #1 SMP Tue Sep 24 13:11:43 CEST 2019 armv7l GNU/Linux

Error code:

root@klk-fevo-03009F:~ # npm install -g --unsafe-perm node-red
npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
/etc/node-v10.16.1-linux-armv7l/bin/node-red-pi -> /etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/bin/node-red-pi
/etc/node-v10.16.1-linux-armv7l/bin/node-red -> /etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/red.js

> bcrypt@3.0.6 install /etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v64-linux-arm-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@10.16.1 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
uname Traceback (most recent call last):
  File "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 13, in <module>
    import gyp
  File "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 8, in <module>
    import gyp.input
  File "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 5, in <module>
    from compiler.ast import Const
ImportError: No module named compiler.ast
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.14.9-klk
gyp ERR! command "/etc/node-v10.16.1-linux-armv7l/bin/node" "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/bcrypt/lib/binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/bcrypt
gyp ERR! node -v v10.16.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/etc/node-v10.16.1-linux-armv7l/bin/node /etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Linux 4.14.9-klk
node-pre-gyp ERR! command "/etc/node-v10.16.1-linux-armv7l/bin/node" "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp ERR! node -v v10.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/etc/node-v10.16.1-linux-armv7l/bin/node /etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)

> bcrypt@3.0.8 install /etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.8/bcrypt_lib-v3.0.8-node-v64-linux-arm-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.8 and node@10.16.1 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
Traceback (most recent call last):
  File "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 13, in <module>
    import gyp
  File "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 8, in <module>
    import gyp.input
  File "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 5, in <module>
    from compiler.ast import Const
ImportError: No module named compiler.ast
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.14.9-klk
gyp ERR! command "/etc/node-v10.16.1-linux-armv7l/bin/node" "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt
gyp ERR! node -v v10.16.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/etc/node-v10.16.1-linux-armv7l/bin/node /etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Linux 4.14.9-klk
node-pre-gyp ERR! command "/etc/node-v10.16.1-linux-armv7l/bin/node" "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt
node-pre-gyp ERR! node -v v10.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok
Failed to execute '/etc/node-v10.16.1-linux-armv7l/bin/node /etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/etc/node-v10.16.1-linux-armv7l/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm WARN ws@7.4.1 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.4.1 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 (node_modules/node-red/node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.8 (node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.8 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ node-red@1.2.6
added 316 packages from 284 contributors in 211.334s


Have you tried running node-red?

I think it installed but some components cannot be compiled (you likely wont be able to use serial port) - this is likely due to the environment (might need to install build-essential)

Ok, we need a broader point of view.
I have tried to run node-red and it works but in fact it was not the main issue. The main idea is to translate LoraWan telegrams to Modbus TCP request with usage of node-red. To do it i need to install ModbusTCP library. But when I do it I receive errors which I have placed below. This is not common hardware like raspberry pi and probably that's the main problem but still, maybe someone can help with it?

2020-12-16T15:17:07.216Z Install : node-red-contrib-modbus 5.13.3

2020-12-16T15:17:07.351Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-contrib-modbus@5.13.3
2020-12-16T15:17:20.211Z [err] npm
2020-12-16T15:17:20.218Z [err]  WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
2020-12-16T15:17:48.681Z [out] 
2020-12-16T15:17:48.681Z [out] > @serialport/bindings@8.0.8 install /home/root/.node-red/node_modules/modbus-serial/node_modules/@serialport/bindings
2020-12-16T15:17:48.681Z [out] > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
2020-12-16T15:17:48.681Z [out] 
2020-12-16T15:17:48.968Z [err] sh: prebuild-install: command not found
2020-12-16T15:17:53.609Z [err] gyp
2020-12-16T15:17:53.612Z [err]  
2020-12-16T15:17:53.613Z [err] WARN
2020-12-16T15:17:53.614Z [err]  
2020-12-16T15:17:53.615Z [err] EACCES
2020-12-16T15:17:53.616Z [err]  user "root" does not have permission to access the dev dir "/home/root/.node-gyp/10.16.1"
2020-12-16T15:17:53.618Z [err] gyp
2020-12-16T15:17:53.619Z [err]  
2020-12-16T15:17:53.620Z [err] WARN
2020-12-16T15:17:53.621Z [err]  
2020-12-16T15:17:53.622Z [err] EACCES
2020-12-16T15:17:53.630Z [err]  attempting to reinstall using temporary dev dir "/home/root/.node-red/node_modules/modbus-serial/node_modules/@serialport/bindings/.node-gyp"
2020-12-16T15:17:53.633Z [err] gyp
2020-12-16T15:17:53.634Z [err]  
2020-12-16T15:17:53.635Z [err] WARN
2020-12-16T15:17:53.636Z [err]  
2020-12-16T15:17:53.637Z [err] install
2020-12-16T15:17:53.638Z [err]  got an error, rolling back install
2020-12-16T15:17:53.648Z [err] gyp
2020-12-16T15:17:53.649Z [err]  
2020-12-16T15:17:53.650Z [err] WARN
2020-12-16T15:17:53.651Z [err]  
2020-12-16T15:17:53.652Z [err] install
2020-12-16T15:17:53.653Z [err]  got an error, rolling back install
2020-12-16T15:17:53.656Z [err] gyp
2020-12-16T15:17:53.657Z [err]  
2020-12-16T15:17:53.658Z [err] ERR!
2020-12-16T15:17:53.659Z [err]  
2020-12-16T15:17:53.662Z [err] configure error
2020-12-16T15:17:53.665Z [err]  
2020-12-16T15:17:53.665Z [err] gyp ERR! stack Error: EACCES: permission denied, stat '/home/root/.node-red/node_modules/modbus-serial/node_modules/@serialport/bindings/.node-gyp/10.16.1'
2020-12-16T15:17:53.666Z [err] gyp
2020-12-16T15:17:53.674Z [err]  ERR! System Linux 4.14.9-klk
2020-12-16T15:17:53.674Z [err] gyp ERR! command "/etc/node-v10.16.1-linux-armv7l/bin/node" "/etc/node-v10.16.1-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2020-12-16T15:17:53.674Z [err] gyp ERR! cwd /home/root/.node-red/node_modules/modbus-serial/node_modules/@serialport/bindings
2020-12-16T15:17:53.674Z [err] gyp ERR! node -v v10.16.1
2020-12-16T15:17:53.674Z [err] gyp ERR! node-gyp -v v3.8.0
2020-12-16T15:17:53.674Z [err] gyp ERR! not ok 
2020-12-16T15:17:55.617Z [err] npm
2020-12-16T15:17:55.618Z [err]  
2020-12-16T15:17:55.619Z [err] ERR!
2020-12-16T15:17:55.619Z [err]  
2020-12-16T15:17:55.620Z [err] code
2020-12-16T15:17:55.621Z [err]  ELIFECYCLE
2020-12-16T15:17:55.623Z [err] npm
2020-12-16T15:17:55.624Z [err]  
2020-12-16T15:17:55.625Z [err] ERR!
2020-12-16T15:17:55.635Z [err]  errno 1
2020-12-16T15:17:55.635Z [err] npm ERR! @serialport/bindings@8.0.8 install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild`
2020-12-16T15:17:55.635Z [err] npm ERR! Exit status 1
2020-12-16T15:17:55.635Z [err] npm ERR! 
2020-12-16T15:17:55.635Z [err] npm ERR! Failed at the @serialport/bindings@8.0.8 install script.
2020-12-16T15:17:55.635Z [err] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-12-16T15:17:55.794Z [err] 
2020-12-16T15:17:55.796Z [err] npm
2020-12-16T15:17:55.797Z [err]  
2020-12-16T15:17:55.798Z [err] ERR!
2020-12-16T15:17:55.799Z [err]  A complete log of this run can be found in:
2020-12-16T15:17:55.800Z [err] npm
2020-12-16T15:17:55.801Z [err]  
2020-12-16T15:17:55.804Z [err] ERR!     /home/root/.npm/_logs/2020-12-16T15_17_55_706Z-debug.log
2020-12-16T15:17:55.873Z rc=1

as Steve hinted you probably need the build-essential tools package installed
and you may want to try installing manually but adding the --unsafe-perm parameter to the command - so npm install --unsafe-perm --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-contrib-modbus@5.13.3 from within your .node-red directory.

#cichy28 are you running Wanesy™ SPN2 for Small Private Network on the Kerlink?
Wonder if your better off running Node-RED on separate device like a RPI or Industrial RPI.

@iiLaw
Yes, i think it is Wanesy™ SPN2 for Small Private Network, but normally node-red is part of it ( at least version 0.18).
In the beginning, I thought that it will be a simple task to do add a proper library to the node-red but as you see I have some problems. In the end, I think that adding RPI as a gateway may be the simplest and the fastest solution.

@cichy28 I've had similar issues with Multitech Conduit AEP it has LNS & Node-RED. But is suck on very old version of nodejs so some custom nodes don't work Modbus :frowning: being one. The MT AEP runs Yocto (as does the Kerlink) but MT doesn't ship with C/C++ compiler which has ruled out some custom nodes.

What has worked well is a MQTT broker and NR on a separate device. If timing is key we use https://revolution.kunbus.de/shop/en/hardware as they have integral RTC they have NR pre installed.

BTW does Wansey SPN2 app server support MQTT or REST for up/downlink integration?

Lawrence

1 Like