Attempt to run node-red admin init failed

I've installed NR 2.01 successfully in Docker on a QNAP NAS.
If I SSH into the container and issue the command :

node-red admin init

All I get is a :
node-red: not found

So, I assumed that although not mentioned anywhere I could find, node-red admin is something that needs to be installed, right? So I tried :

sudo npm install -g node-red-admin

That too failed because the container image I pulled from Docker HUB doesn't understand sudo. So, I tried without, and I got this:

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules                                                                                                                                                                                                                                                                 
npm ERR! code EACCES                                                                                                                                                                                                                                                                                                                          
npm ERR! syscall access                                                                                                                                                                                                                                                                                                                       
npm ERR! path /usr/local/lib/node_modules                                                                                                                                                                                                                                                                                                     
npm ERR! errno -13                                                                                                                                                                                                                                                                                                                            
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'                                                                                                                                                                                                                                                               
npm ERR!  [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {                                                                                                                                                                                                                                                          
npm ERR!   errno: -13,                                                                                                                                                                                                                                                                                                                        
npm ERR!   code: 'EACCES',                                                                                                                                                                                                                                                                                                                    
npm ERR!   syscall: 'access',                                                                                                                                                                                                                                                                                                                 
npm ERR!   path: '/usr/local/lib/node_modules'                                                                                                                                                                                                                                                                                                
npm ERR! }                                                                                                                                                                                                                                                                                                                                    
npm ERR!                                                                                                                                                                                                                                                                                                                                      
npm ERR! The operation was rejected by your operating system.                                                                                                                                                                                                                                                                                 
npm ERR! It is likely you do not have the permissions to access this file as the current user                                                                                                                                                                                                                                                 
npm ERR!                                                                                                                                                                                                                                                                                                                                      
npm ERR! If you believe this might be a permissions issue, please double-check the                                                                                                                                                                                                                                                            
npm ERR! permissions of the file and its containing directories, or try running                                                                                                                                                                                                                                                               
npm ERR! the command again as root/Administrator.                                                                                                                                                                                                                                                                                             
npm ERR! A complete log of this run can be found in:                                                                                                                                                                                                                                                                                          
npm ERR!     /usr/src/node-red/.npm/_logs/2021-07-21T20_22_04_066Z-debug.log

I am amazed about the wast distance between the simplicity and ease-of-use described in the "Getting Started" section, and the real world whenever I actually try to do what it says - always! (Why is it that whenever I try anything in the Linux world, nothing ever works as described?)

Oh, it always works as described. It's just that what was described actually came through a multi-dimensional wormhole and you, as a mere non-linux specialist, don't have the 10-dimensional brain that the author has.

At least that's what I've always believed about authors of Linux documentation! :rofl:

What other reasonable explanation could there be?

Maybe a little harsh when you consider the multitude of different operating systems, and user environments where node-RED is expected to faultlessly perform, especially when the issue relates to an update made just a few days earlier...

1 Like

I’m always amazed at the vast number of hardware and os variations that people try to run things on.

The error shown says that it is the actual node-red command is not found in the path. So you just need to locate that in your system.

Thank you. That was at least a hint in a direction.
Obviously, building the image so that the admin tool became available on the path (or extending the path to include this tool - wherever it is located), never crossed the mind of any of the developers, and the author of the docs never bothered to mention where to find it.
Isn't that great?

So, I did this:
find -name node-red.*

and this is what I got:

find: ./proc/tty/driver: Permission denied                                                                                                                                                                                                                                                                                                    
find: ./root: Permission denied                                                                                                                                                                                                                                                                                                               

So, I'm still stuck in the Linux mud.

Well I’m sure if someone donated one set of every possible piece of hardware to the developers they would be delighted to check it for you.

Maybe try just find . -name node-red

1 Like
find: ./proc/tty/driver: Permission denied                                                                                                                                                                                                                                                                                                    
find: ./root: Permission denied                                                                                                                                                                                                                                                                                                               

Is the one to try first

No idea why npm on your system doesn’t add that .bin directory to your path for you.

"my system" ?
I just copied "latest" image from Docker HUB. How can that be "my system" ?

Ah right it’s in docker

Yes, it's in docker.
And I find it strange that the main executable (node-red) isn't on the path!
How come the container managed to run this executable at all, when it's not even on the path?

the container calls it explicitily - but it should be at node_modules/.bin/node-red admin init

Yes, I found it now - thanks to you :slight_smile:

and yes - will think about adding to path properly. thanks

1 Like

Many thanks for your help.

latest version (2.0.2) now has path fixed...

1 Like

Uhuu... that was fast!
So my "grumpy" remarks did end up as a contribution! Maybe Linux isn't that bad after all :+1::hugs:

1 Like

The stars aligned well. It was a simple fix, I was near WiFi (on vacation), and there was a new release today.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.