Script installing modules

i've set up a script to do most of what i want but it seems that nodes won't install. i'm on raspberry pi. am i just stupid and missing something obvious? (or both)

i've tried with and without sudo, here's the output, but after restarting node-red and the pi, i still don't see the module loaded. i have quite a few i'm installing and it would be nice just to script it.

of course it 'works' just going through the palette manager

=========================================================
pi@raspberrypi:~/.node-red $ sudo npm install node-red-contrib-ip

  • node-red-contrib-ip@1.0.2
    updated 1 package and audited 177 packages in 14.316s

33 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

================================================

Well, you've really not given us anything to go on have you?

We need to know about your script and what you are trying to install.

I posted the output from my command line?

to be clear, I don't need assistance with the script the large portion of it works correctly. the only thing that isn't working is using npm to install nodes from the pallete.

as a result of that not working I tried it directly from command line and see that it does not work as showing my example. I just need help with a command line that will do this installation, or pointing me in the direction of what the pallet manager in the UI does that I am missing from my command line argument.

the example node from the command line I posted is fine to use, but of course it shouldn't matter what module.

We need to see the script output from a failing install.

It looks like your install works correctly. However, what is not clear is the node red that you run - how do you run it (service? Command line? Portainer/docker?) Where is its installed? How did you install it?

Could you show us the output from your node red startup? That will identify the node red instance you are running and where it is installed.

In simple terms, you may be installing a node to ~/.node-red but your node-red could be running somewhere else. Even a different PI (I've seen people do that too).

I feel like I made my life difficult by even saying script. all I want is something that I can type into the terminal that will install a node.

I assume it should be a one-line solution I posted in my original post where I tried to do it through the command line and the output that I got. is there a way to get more verbose output?

i used the install script for nodejs/node-red for raspberry pi

https://nodered.org/docs/getting-started/raspberrypi

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

i type node-red-start right now but it will be an auto start service as shown in that page above.

everything is default, i changed nothing.

what would you guys use to install node via cmdline? is my syntax correct?

It appears to be - apart from the sudo - don't use sudo.

Can you...

  • Start node red from a terminal using node-red
  • Copy the start up to a reply post
  • Show us what is in ~/.node-red/package.json

The other thing to mention is that Node-RED looks for nodes to load under 2 situations

  1. At startup it scans the userDir node_modules directory (and the Node-RED install hierarchy) for nodes
  2. When a node is installed via the manage palette option (this only loads nodes from the new module, it does not do a full scan)

So if Node-RED is running and you install a node on the command line, it will not appear in the editor until you restart Node-RED.

Having used sudo you may have left some files in your home directory with root permissions. If you get permission errors when trying to install nodes in the future then you will need to change the files in your user directory back to the node red user.

The normal way to install nodes from command line is like

cd ~/.node-red
npm i name-of-new-node
node-red-reload

If running from a script you may need to make the path to your user directory (the .node-red one above) into an absolute path

looks like its the 'i'm an idiot and missed something flag'

i wasn't aware you HAD to be in the .node-red directory to install modules. seems like all is good after that.

thank you to everyone that took the time to try to help me

1 Like

Your first post showed you were in .node-red...

.. which is why most of us dismissed that as the issue.

it must have been a combination of the two things working together to foil my plans

thanks again everyone, i'm doing another fresh install soon and if this topic isn't closed i'll post my results

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