Migrating Node-Red to another Windows machine

I put together a proof of concept on a personal Windows PC, but now my company is ready to purchase equipment. I need to move my Node-Red instance to a new PC. How do I do this?

Thanks,
Mike

Hi Mike, I have never done such kind of migration but I am interested to learn, so I will track this post to see the outcome (wishing you success).

If I was tasked to do something similar I would manage as a fresh installation followed by the transfer of the existing Node-RED flows, so the following questions come to my mind:

  • First thing read carefully the installation guidelines https://nodered.org/docs/platforms/windows
  • The new machine will run the same operating system?
  • I would be careful to install in the new machine the very same version of Node.JS (and npm) as well as the same version of Node-RED from the existing machine (just to avoid any surprises)
  • I would try to copy the content of ~/.node-red from the existing machine to the new one. This will bring your flows, your package.json file, settings.js file, the project folder (if you use this feature) and a few more that are important.
  • The folder /node_modules inside ~/.node.red has to be copied to the new machine or alternatively you can run the command npm install from the folder that contains the file package.json. npm install will rebuild the node_modules based on the content of package.json
  • I would pay special attention in case you use a local folder in your machine to host local files. Most likely the home directory will change in the new machine so you have to verify this part of the settings.js file (below is specific to my computer - OCM is my username:
     //httpStatic: '/home/nol/node-red-static/',
     httpStatic: "C://Users/OCM/.node-red/projects",
    

You should, if you don't already, be using the projects feature of Node Red. For something in a production environment you need the safety git offers, especially for re-distributing code.

Thank you Andrei,
I will post my experiences with this transfer. Currently getting replacement PC/ Workstation quoted.

As for the projects feature, I will enable it after I do the migration. I am afraid I might corrupt my files.

Thanks,
Mike

There are only a few files that contain the logic and secure configuration information. Along with the settings.js file, you can check all of these into a private git repo. You can also use npm to ensure any required nodes are easily and consistently installed on target systems.

Just note that the flows file is, by default, named after the system that created it. However, this can be change by settings.

So I recommend reading up on npm then creating a post install script if needed and then putting everything into git with use instructions on how to use npm to install from git. That should actually then work on any platform assuming you haven't coded in something platform specific.