Rpi-gpio input node "stopped"

is the failure line... so can you at a command line do

cd /usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/hardware
./nrgpio info

@dceejay I guess you got the problem... this is the output of the command:

raceback (most recent call last):
  File "./nrgpio.py", line 17, in <module>
    import RPi.GPIO as GPIO
ModuleNotFoundError: No module named 'RPi'

In addition I've tried to use the node-red-contrib-camerapi node, and also in this case the node doesn't work.
So... I decided to install a new Rasbian on an a new SD card and then tried to use the GPIO and the camera and now all works.
Well, what I've broke on the original Rasbpian?

looks like the python gpio libraries weren't installed.. which is odd as they are by default... (and I thought the gpio command may have used them... but maybe not) - but hey... you're off and running now.

Now I'm running on a newly freshly Raspbian installation.
I think is a good idea to forget the "old broke" system (due to unusual problem) and restart with a new good system. Isn't right?

Well you may be able to

sudo apt-get install rpi.gpio

to get it back - but who knows if there is anything else missing... a clean install would be cleanest.

2 Likes

Whatever this is, it's still broken. I've installed a fresh current Raspbian on a new RPi3B+ and installed Node-RED from the package repository. It has the Pi GPIO nodes, but input nodes say "stopped" on every pin I selected. There's no error message anywhere in the system log or debug console. What else can I try?

Have you tried installing as per the docs?

You can do that over your existing install

I've installed it like this:

sudo apt install nodered

It then installed a ton of packages. Whate else is there to installing Node-RED on a Pi? The rest of the system works as expected. I can use GPIO output, but not input. I've also verified on the command line that my input pin has the expected levels. It's just the input node that rejects to work.

Well the recommended is documented on the ā€œgetting startedā€ ā€œraspberry piā€ page in the docs on the website.

If your current install has issues what have you got to lose?

What's wrong with using the package that's already there? The docs fail to explain this. Is the available package in Raspbian considered bad or broken for some reason? I mean, it comes with the OS for the Pi, so I guess it should be well adapted to it, which isn't always the case with the original source.

I guess the script gives me the new v1.0 with doesn't have Pi nodes included. I'll have to reinstall those then.

One of the reasons is that the version installed by the package manager is quite old, and that the corresponding NodeJS version that is installed is no longer supported by Node-RED. So if you try to upgrade it manually afterwards, you run into all kinds of different problems related to that. Installing through the install script gets rid of those issues, and adds repositories for the correct NodeJS packages so you can install updated versions without an issue.

So I reinstalled node-red with that script. Now it's not working as before anymore. I had installed the node-red-contrib-i2c package and its nodes are now missing. I also cannot uninstall it without losing these nodes. And I cannot reinstall it because it's already installed. Also, the GPIO nodes are still there and there's no issue reported for them, but they're essentially dead.

Update: The GPIO nodes are probably dead because the whole flow won't start anymore due to the missing i2c nodes.

Oh, here's an error line from the log:

2 Oct 21:17:09 - [warn] [node-red-contrib-i2c/i2c] Error: libnode.so.64: cannot open shared object file: No such file or directory

What is this libnode.so anyway? I couldn't find relevant information about it online. There are packages I could install but they'd remove node.js so that's not what I need. Does Node-RED 1.0 run on a Pi 3 B+ at all? Or should I rather use the prepackaged version that comes from the makers of the Pi?

Run

node-red-stop
node-red-start

and copy/paste the output here.
The i2c node error is not an error, it is a warning, so should not be serious. If it is serious that that is a bug in the node.
No you should not use the version that comes with the Pi, you should use the version specially configured by the developers.

2 Oct 21:55:53 - [info]
Welcome to Node-RED
===================
2 Oct 21:55:53 - [info] Node-RED version: v1.0.0
2 Oct 21:55:53 - [info] Node.js  version: v10.16.3
2 Oct 21:55:53 - [info] Linux 4.19.75-v7+ arm LE
2 Oct 21:55:54 - [info] Loading palette nodes
2 Oct 21:55:57 - [info] Dashboard version 2.16.3 started at /ui
2 Oct 21:55:57 - [warn] ------------------------------------------------------
2 Oct 21:55:57 - [warn] [node-red-contrib-i2c/i2c] Error: libnode.so.64: cannot open shared object file: No such file or directory
2 Oct 21:55:57 - [warn] ------------------------------------------------------
2 Oct 21:55:57 - [info] Settings file  : /home/pi/.node-red/settings.js
2 Oct 21:55:57 - [info] Context store  : 'default' [module=memory]
2 Oct 21:55:57 - [info] User directory : /home/pi/.node-red
2 Oct 21:55:57 - [warn] Projects disabled : editorTheme.projects.enabled=false
2 Oct 21:55:57 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi3b.json
2 Oct 21:55:57 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
2 Oct 21:55:57 - [info] Waiting for missing types to be registered:
2 Oct 21:55:57 - [info]  - i2c out
2 Oct 21:55:57 - [info]  - i2c in
2 Oct 21:55:58 - [info] Server now running at http://127.0.0.1:1880/

And the message I get in the UI:

Flows stopped due to missing node types.

i2c out
i2c in

Actually it is confused about whether it is a warning or an error isn't it, it first says Warn, then error.
In the terminal go to the .node-red directory then
npm remove node-red-contrib-i2c
and assuming that says it has removed it then
npm install node-red-contrib-i2c
and post the result here, unless that fixes it.

It didn't uninstall the package. And when I tried to install it, it did something more it didn't tell me about.

pi@raspberrypi3b:~/.node-red $ npm remove node-red-contrib-i2c
npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules/rmp-client" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2019-10-02T20_14_32_970Z-debug.log
pi@raspberrypi3b:~/.node-red $ npm install node-red-contrib-i2c
+ node-red-contrib-i2c@0.5.2
removed 5 packages, updated 1 package and audited 633 packages in 8.409s
found 1 moderate severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

Now my other nodes that I have written myself (and that are working fine in every other Node-RED setup so far) are also missing, in addition to i2c. It's getting worse and worse. The prepackaged Node-RED didn't have these bugs.

The main problem is that you've started off the wrong way and now your fighting the errors that this is causing.

We can carry on trying to sort out a bad situation but it's going to be much easier to start again

How did you install those? npm will remove any nodes that are not referenced in package.json. That is nothing to do with node-red, but may be due to the fact that you are now using a current version of npm rather than an old one.

I copied in the module directory into ~/.node-red/node_modules and added it to ~/.node-red/package.json as dependency. This worked before. My code isn't public so I cannot use any public registry. NPM is a bit stupid and can't use non-public code otherwise. That's why I had to do it manually. It's not like NuGet which works just fine with local packages.