Hi there,
i have some bigger questions, which in fact at the moment I can't find a solution.
To describe the situation:
- I am behind a corp proxy and therefore I'm getting trouble with SSL Certs all the time
- I need to test flows, which I put on machines (without install there)
The idea (wich is currently working in most cases) is:
- Setup a machine with a current version of NodeJS (16.3.2) - download and install normally.
- Create a dir, where I want to have NodeRED installed (eg. C:\NodeRED1, C:\NodeRED2)
- 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 http://registry.npmjs.org
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.
- Is the way I am applying the NPM correct? Did I understand the way it works (for local only packages)? What should I change?
- How to fix this loading error?
- What do the errors at starting mean?
- 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: