Node-red-node-serialport 0.6.8 not working (0.4.2 do)

#1

Sorry about that generally topic, but i do not really know how to ask.
I have a heatpump system with an USB-Interface which sends and receives simple Strings like "13 1234"
Want ro read/write this strings.

With my Device A it works
Device B not works (no data in or out), but i have no idea why.
When i Install the older version of the node-red-node-serialport node it works fine. But what can i try, that i can use newer version?

THANK YOU

Device A:
Hardware NanoPi NEO2
Ubuntu core 16.04 LTS 4.11.2
Linux 4.11.2 arm64 LE
Node.js version: v4.2.6
Node-RED version: v0.16.2
-> node-red-node-serialport 0.4.2

Device B:
Hardware NanoPi NEO2
Ubuntu core 16.04 LTS 4.14.52
Linux 4.14.52 arm64 LE
Node.js version: v4.2.6
Node-RED version: v0.19.5
-> node-red-node-serialport 0.6.8
--> After installing node-red-node-serialport 0.4.2 the serial port works fine

0 Likes

How to manage WIFI settings via dashboard
#2

You are using a very old version of nodejs that is out of nodejs support. While v0.19 of Node-RED supports it, it will be the last version that does. https://nodered.org/blog/2018/08/14/version-0-19-released

node-red-node-serialport relies on the serialport package. That package only supports Active Maintenence and LTS version of nodejs.

My guess is the v0.19.5 of Node-RED is requesting the latest version of serialport which doesn't support nodejsV4.

Have you tried updating nodejs to v8 or v10 and then trying?

0 Likes

#3

My System is tested and stable since years, but you are right. Maybe this will solve my problem.
The image vor the nanopi neo2 is on ubuntu 16.04. I hope nodeJS 10 works well on that system.
I will try ...
Thank you.

0 Likes

#4

I'm afraid that you really can't rest on your laurels when it comes to computers. You need to keep patching and updating.

0 Likes

#5

Thats what i mean:
The newer version gives me tonnes of errors:

Ubuntu core 16.04 LTS
Linux 4.14.52
npm -v 6.4.1
node -v 8.12.0 LTS
Node-RED version: v0.19.5

gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2

....

node-pre-gyp ERR! Tried to download(404):
....
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute ....
....

node-red-node-serialport 0.6.8

not possible to install

0 Likes

#6

Do you have build tools installed? Looks like you are missing something that Gyp needs.

0 Likes

#7

I have done exactly that, nothing else

sudo apt install curl
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
sudo apt-get install nodejs
sudo npm install -g --unsafe-perm node-red node-red-admin

0 Likes

#8

You need to

sudo apt-get install build-essential python-dev

Then retry the node-red serialport imstall

2 Likes

#9

I have done that and after that i was able to install "serial-node" via the pallette in node-red.
Serial Interface now works (not to forget to put the user into the group "dialout" :wink:

What i am not understand is, why there ar so many errors in Node-Red, when i follow the "official" insallation manual. There are important files which are missing to download etc.

I need to install abput 100 Raspi and i want to have a good feeling on stability, but it is not that easy.

Anyway!
Thank you for helping me out!

0 Likes

#10

bcrypt@2.0.1 install /usr/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v2.0.1/bcrypt_lib-v2.0.1-node-v57-linux-arm64-glibc.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@2.0.1 and node@8.12.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
make: g++: Command not found
bcrypt_lib.target.mk:101: recipe for target 'Release/obj.target/bcrypt_lib/src/blowfish.o' failed
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 127
make: Leaving directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.14.52
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/lib/node_modules/no de-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding" " --napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /usr/lib/node_modules/node-red/node_modules/bcrypt
gyp ERR! node -v v8.12.0
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 '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module= /usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/lib/node_modules/node-red/node_modules/b crypt/lib/binding --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/lib/node_modules/node-red/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.14.52
node-pre-gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-red/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp ERR! node -v v8.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.9.1
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/node-red/ node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_versio n=3 --node_abi_napi=napi' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@2.0.1 (node_modules/node-red/node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@2.0.1 install: node-pre-gyp install --fallback-to-build
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

  • node-red@0.19.5
    added 319 packages from 308 contributors in 207.105s
    0.19.5
    npm WARN deprecated bcrypt@0.8.7: bcrypt < v2.0.0 is susceptible to bcrypt wrap-around bug. Upgrade to bcrypt >= v2.0.0 for improved support for newer bcrypt hashes
    npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
    npm WARN deprecated boom@2.10.1: This version is no longer maintained. Please upgrade to the latest version.
    npm WARN deprecated hoek@2.16.3: This version is no longer maintained. Please upgrade to the latest version.
    npm WARN deprecated cryptiles@2.0.5: This version is no longer maintained. Please upgrade to the latest version.

bcrypt@0.8.7 install /home/pi/.node-red/node_modules/bcrypt
node-gyp rebuild

make: Entering directory '/home/pi/.node-red/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
make: g++: Command not found
bcrypt_lib.target.mk:101: recipe for target 'Release/obj.target/bcrypt_lib/src/blowfish.o' failed
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 127
make: Leaving directory '/home/pi/.node-red/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.14.52
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/.node-red/node_modules/bcrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@0.8.7 (node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@0.8.7 install: node-gyp rebuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

0 Likes

#11

HI,

the clue is near the top of the first error
image
So you still don't have quite enough pre-reqs.

As it happens these are only warnings - as they end with npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1 - so in fact it should now work and be ok... - However the lack of g++ may well cause issues moving forwards, - as with serialport - and maybe other extra modules, so it would be best to fix.

Most full fat (ie default installs) come with the necessary pre-reqs which is probably why we missed them from the list. - Normally sudo apt get install build-essential should be all that is needed - but maybe not in Ubuntu core...

Also note that we do now have a snap version of Node-RED available via their snap store.

1 Like

#12

Hmm- just had a look at Ubuntu core... - that is not exactly a standard Linux install - so no wonder we don't have docs for it :slight_smile: - Would be happy to receive some docs if you or anyone are willing ?!?

But please note there is still an outstanding issue with snaps and usb serial ports - [Announce] Node-RED snap 0.19.5 available

1 Like

#13

Thank you for your thoughts!!! Now I begin to understand!
I love to write docs, but i can do it about topics i anderstand. Linux is not one of these.
Be happy to build a system where i can test my ideas ...
This snap-thing is very interesting, i anyway want to try.

0 Likes

#14

Indeed. But being the first to try this (publically) under core makes you the expert ! :grin:

Let know how you get on.

0 Likes

#15

WOW - easy living!

Hardware: Nanopi-NEO2 from FriendlyARM
http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO2

Burn a fresh SD-Card with Win32diskImager:
-> nanopi-neo2_sd_friendlycore-xenial_4.14_arm64_20181011.img
-> this is Ubuntu 16.04 Core with 4.14 Kernel

Start the Pi and log in via putty
-> user "pi" and password "pi" (standard)

Install snap
$ sudo apt update

$ sudo apt install snapd

Install node (Node-RED recommend V8 on their Website (2018-11-19))
$ sudo snap install node --channel=8/stable --classic

Install Node-RED:
$ sudo snap install node-red

Reboot the PI
$ sudo reboot now

Wait for 30 Seconds

Go to your browser and try
http://nanopi-neo2:1880
or find out the ip-address of yor pi ond try
http://ip-address:1880

Really Great!

Comments :slight_smile:
Node-Red runs as a service and start up with ubuntu - GREAT!
serial I/O node is installed and works perfect! - GREAT!

Install Dashboard-Nodes via Menue -> Manage palette -> node-red-dashboard
-> works perfect (maybe the numbers in the msg.payloay tell you nothing, but they are fine)

:face_with_monocle:
Node-Red is running under root
-> is this save?
-> i have no idea.

You find the settings.js in /root/snap/node-red/current
"current" is just a link to the "real" directory (in my case "157")

Over all a great and very easy solution to install nodejs and node-red!
Great Job! Big "thank you" to the devs.

0 Likes

#16

Create Password hash for node-RED Admin:

Install bcryptjs:
$ sudo npm install bcryptjs

$ node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" your-password
-> gives you the hash for your-password back

0 Likes

#17

Ideally you don't run in "classic" mode as that does indeed then give you full access - but as per the issues USB serialport is not fully (easily) supported in confined mode - so yes classic is probably the way to go for serial for now...

So yes root is a concern - but depends what the risk profile for your devices and their operation is.

0 Likes

#18

What does "confined" mean for the USB-serialport. Is it only the group "dialout" or is it more to do? I don't try that mode.
Do you have a link, where i can read all that stuff about "classic" and "confined"?

0 Likes

#19
1 Like

#20

In most Howtos you can read that the User who runs node-Red must be in the user group "dialout" like "/dev/ttyUSB0"

BUT!
I found out, that Node-RED also has to run under "root" like "/dev/ttyUSB0".
Than you have no problems at all.

0 Likes