I am setting up a "popup tent" server that will auto install node-red via a script and import a flow that will result in missing node types by default. I can install these manually via the 'Manage Palette', but I need it to do it automatically.
Is there a way to automate the installation of the missing node types, so things can install and have the flows working "out the box" after a node-red script install??
Further:
This is going on a cheap, low memory droplet, and when I did an npm install , it would eat up the memory and result in a Cannot allocate memory error, and lock up my server, making basic commands throw that same error.
The solution to the first part is to also provide package.json and package-lock.json then to run npm install in the .node-red folder, which will automatically install the required nodes.
I don't know of any solution to the second problem other than pay for more memory.
Your two options are either just copy over the package.json and run npm install which you say blows memory, or to zip up the .node-red/node_modules dir and move it over and unzip it
Am I right in thinking that may not work if the source and destination have different versions of nodejs or the hardware is different? Does the OS matter?
yes absolutely it may matter - but if it goes bang trying to install "properly" then it may be solution if they have a golden master that can be copied across.
This makes sense, as these two solutions were in my "trial and error" queue. I will try these and report back. [Thank you]
For the sake of being on the cloud with minimal RAM, I think solution of copying the whole node_modules over would be best, as I want to avoid crashing the cloud server.
If your development machine has the same version of nodejs, the same hardware architecture and the same OS and version as the server then you should be ok.
I was able to copy the node_modules folder over with the package.json and package-lock.json files. This brought over all the needed node types and the only thing that came up was a sql node that was in the flow but never installed via the palette.... there were about 15 other node types it originally needed in the flow and after transfer it never complained about them being missing ... that would be a success.
I yet to try the "npm install" method on the tiny cloud server.