Unable to update nodes

I have updated Node-RED on one of my Pi's, and that worked nicely. But updating the nodes did not go that well. I first tried with Palette manager and got "Failed to update: node-red-contrib-fs-ops, Install failed, Check the log for more information"

I cheched the log, and it seemed like a permission problem:

ERR! Error: EACCES: permission denied, access '/home/pi/.node-red/node_modules/node-red-contrib-fs-ops'

Next step was manual installation, first by finding out which nodes that I needed to update:

cd ~/.node-red
npm outdated

So I tried using command line with sudo, but that gave me this:

pi@Z-Wave-Tellstick:~/.node-red $ sudo npm install node-red-contrib-fs-ops
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

+ node-red-contrib-fs-ops@1.5.0
updated 1 package and audited 1662 packages in 16.863s
found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for detail

And even if it says that "updated 1 package, the node is still on the old version. An idea what's happening here? There were in total six packages I tried to update, and none of them did
Another one of my Pi's, which has the exact same "roots", built in December some time, updated without problems. I installed one Pi first with all the common stuff they all need installed and then split them into different uses and install the extra packages needed.

The error message is because you probably chose to install it using sudo in the past

cd into the /home/pi/.node-red/node_modules/ directory
ls -l and see who owns the directories...

Thanks! But as I said I installed on the common "mother" and then only added the nodes I needed. Shouldn't that be the same on all, then? Also shouldn't it still work using

sudo npm install

Edit: And yes, root owns them. But am I not installing as root? If not, what should I do?

You've logged in as pi. No you shouldn't be installing as root, you should never use the command sudo unless it is specified. It causes problems later such as this.

The command you should have used to install the node is listed in the nodes ReadMe.

You should no fix your permission/ownership problems and try again.

I checked the other one that worked to upgrade, and pi was the owner there, so you're of course right. What I can't fathom is how root somehow has taken ownership over the folder, because as I said, I installed Node-RED only once and then split into the different Pi's. Also I have my install info here, and this is the command I used to install:

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

So now on to Google to find out how to change permissions... :wink:

Edit: sudo chown pi:pi -R /home/pi/.node-red/node_modules and it works. Thanks again! :slight_smile:

1 Like

Btw this comes on all the updates, is it something I should worry about?

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.5/bcrypt_lib-v3.0.5-node-v57-linux-arm-glibc.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.5 and node@8.16.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)

in general no as it's an optional-dependency - but we can't see how that finished so can't comment if it was good or bad. If on a Pi it should complete successfully.

Well, Node-RED seems to work normally, so I guess it finished successfully, then. :slight_smile:

well as I said it's optional so should work either way... but it handles encryption/decryption much faster if it is there and working.

I don't think I use encryption for anything. Or is that an integral part of Node-RED?