Double question: Installation of NodeRED in MultiInstance and also "to go" on Win10 / Problem stuck loading plugins

Hi there,

i have some bigger questions, which in fact at the moment I can't find a solution.

To describe the situation:

  1. I am behind a corp proxy and therefore I'm getting trouble with SSL Certs all the time
  2. I need to test flows, which I put on machines (without install there)

The idea (wich is currently working in most cases) is:

  1. Setup a machine with a current version of NodeJS (16.3.2) - download and install normally.
  2. Create a dir, where I want to have NodeRED installed (eg. C:\NodeRED1, C:\NodeRED2)
  3. Copy a sample install to there .... run a batch, which calls NPM to locally install a fresh version of NodeRED with a specified set of addon-nodes.

For this, I created the following files ... please note, I had to rename them to .txt since else I could not upload it
addon.nodes.txt (309 Bytes)
core.nodes.txt (290 Bytes)
install_pro.cmd.txt (4.4 KB)
startnodered.cmd.template.txt (300 Bytes)
then I added a sample settings.js as template too...
settings.js.template.txt (11.9 KB)

If you put all the files into the destination directory like this:

and start the "install_pro.cmd" ... it will download all modules.

Basicly it is doing the following (%1 is one of the modules, %cd% is the path, the CMD was run at):
call npm install -safe --prefix %cd% %1

I'm using Powershell to replace placeholders in my templates to fix the path and ports to the wanted setup.

In the Core.Nodes and Addon.Nodes I added just the names of nodes I need to install. This keeps it clean and easy.

so unwrapping the CMD would be something like:

set version=latest
set curpath=C:\NodeRED1 
call npm set strict-ssl false
call npm config set registry
call npm install -safe --prefix C:\NodeRED1 node-red@latest
call npm install -safe --prefix C:\NodeRED1 node-red-contrib-crypto-js
call npm install -safe --prefix C:\NodeRED1 node-red-contrib-fs
call npm install -safe --prefix C:\NodeRED1 node-red-debugger
REM and so on...
call npm install -safe --prefix C:\NodeRED1 node-red-contrib-watchdirectory
set NodeREDHomePathWinDir=C:\NodeRED1\node-red_home
set NodeREDNodesPathWinDir=C:\NodeRED1\node_modules
SET NodeREDHomePathJavaDir=%NodeREDHomePathWinDir:\=\\%
SET NodeREDNodesPathJavaDir=%NodeREDNodesPathWinDir:\=\\%
ECHO HomePath is [%NodeREDHomePathJavaDir%]
ECHO NodePath is [%NodeREDNodesPathJavaDir%]
set NodeREDPort=1880
set /p NodeREDPort=Using Port %NodeREDPort%? [ENTER=OK/any number between 1 and 65535 to choose another port]
powershell -Command "(gc C:\NodeRED1\node-red_home\settings.js.template) -replace '@dir@', '%NodeREDHomePathJavaDir%' | Out-File -encoding ASCII C:\NodeRED1\node-red_home\settings.js.port"
powershell -Command "(gc C:\NodeRED1\node-red_home\settings.js.port) -replace '@port@', '%NodeREDPort%' | Out-File -encoding ASCII C:\NodeRED1\node-red_home\settings.js.nodes"
powershell -Command "(gc C:\NodeRED1\node-red_home\settings.js.nodes) -replace '@nodesdir@', '%NodeREDNodesPathJavaDir%' | Out-File -encoding ASCII C:\NodeRED1\node-red_home\settings.js"
powershell -Command "(gc C:\NodeRED1\startnodered.cmd.template) -replace '@dir@', '%NodeREDHomePathJavaDir%' | Out-File -encoding ASCII C:\NodeRED1\startnodered.cmd"

If you put a copy of your nodeJS dir into this folder (like in the screen) and a copy of npm you can simply zip the filder and move it to any machine with Windows OS u like and unpack to the same foldername and it runs (without the need to install NPM, NodeJS etc.).

This feature worked for month so far (and I still have working copys (done by the same script). Since a few days I have a strange error ...

Somehow nowadays I get the following errors while starting NodeRED

and furthermore, if i open the website, it hangs here:

Dev Tools show this:

So I like to kindfully ask for help.

  1. Is the way I am applying the NPM correct? Did I understand the way it works (for local only packages)? What should I change?
  2. How to fix this loading error?
  3. What do the errors at starting mean?
  4. How to create certs / hash by batch to make the installer complete ...

Would be cool to have a nice to "go/portable" installer after this discussion. Maybe this can help others to get it working more easy in Windows OS.

Also I like to point out, that the spamming of NPM to the users dir, is a really bad idea if you are running a network hostet profile management in companys. This is why I try to make it "portable"

One thing i am currently still missing is the creation of the Certificates by commandline like this:

and the adding of a PW hash to the config by commandline:

I havent' really got my head around all that you've said and I need ot get on with some other stuff but I wanted to say that this kind of thing was one of the reasons I came up with my alternate installer (check it out on my github).

With that, you install node-red to a local folder and set your userDir to be a sub-folder so that everything is in one place. Once set up, you can simply repeat the same process to get another clean setup or configure the package.json in the sub-folder and copy everything except the two node_modules folders. I think that 2nd approach is closer to what you want, putting any standard files and even flows into the data sub-folder. All you need to do is run npm install in the top and sub-folders and everything is ready.

1 Like

Sounds good, I did not find it before... Will give it a try.

Downloaded your Repo and installed:

seems to work so far ... now adding the nodes I need

@TotallyInformation .... how would I add nodes to this project?

As I did it by this before...I wonder how it should be done in your case?

npm install -safe --prefix C:\NodeRED1 node-red-debugger

is the one I am running right in the master template results to this:

Which is already pretty cool.

I will work with my installer around your pack... If this works fine, maybe you can adopt it?

I don't think you need the prefix - in fact, I don't really know what that does. The point of my approach is that everything is encapsulated in a single folder. So npm sorts everyhing out itself.

Node-RED accepts nodes installed either in the master folder or in the userDir data folder. However, if you install in the master folder, you cannot remove/update using the palette manager in the Node-RED Editor. This could be an advantage or not depending on what control you want to give to people who have access to the Editor. Nodes installed to the master folder have to be installed by npm but still show up and work fine in the Editor.

Always happy to take a closer look and adapt if it will help other people. The alternate installer isn't attempting to be a complete installer solution - at least at present - I created it to help me do quick installs for multiple test installations. So I make no attempt at trying to set up a service definition for an install though you will see that there are example scripts in the repo that demonstrate what might be possible.

So there is always an opportunity for adding features and capabilities if they might be useful to people.