Synchronize multiple Windows PCs

I need your help pls.
I tried serveral days now to synchronize mulitple windows pcs and i am trying to find the best and easiest way to do this.

What i want to do:
Install NodeRed and all Modules at the same Version.

What i tried till now.

  • I copied the node_modules folder and the settings file to the new win10 machine. -> Not so good.
  • I copied the package.json and settings file and installed the moduls per npm install -> Much better but still not really happy.

Does someone have a better solution to synchronize multiple win pcs?

Best regards! :slight_smile:

I don't think you can "just" copy the directory to some other system as the package.json gets updated with local dependencies.

install node-red on the "new" system and manually install the node packages required.

To elaborate further, on your current system you can get a list of all the installed packages by doing:

node-red admin login    // login with your user/pass
node-red admin list   

This will list all the installed packages, which you can install on the new system via npm install

But with this list i get no Version number and i cannot install all modules on the new System with the newest Versions. At some Modules i need a specific Version.

And to install all modules manually is also not really praticable because i have a lot of modules and about 100 win machines. Or is there a solution to install multiple modules at the same time automaticaly?

If you have 100 win machines and you want to have equal installs you may want to look at different solutions, like ansible or docker with a prebuild image containing all modules.

The purpose of npm is to "manage" the packages on the local machine, if you manually start to copy things, it somewhat defeats the purpose.

note that you can retrieve the versions using:

cd ~/.node-red
npm list --depth=0

You can copy the whole userDir folder to another PC and it will work just fine with one exception. By default, Node-RED names its flow and credentials files with the current machine name, so it won't be recognised on a different machine.

So you should start by changing the name on the original machine so that you have a standard name to use. Then change your startup command accordingly.

However, as you've noted, this is a very heavy copy since the node_modules folder is copied.

A better approach is to exclude the node_modules folder from the copy and add a command to the end of the copy script so that you cd into the userDir folder and run npm install. After that, you should be able to start up Node-RED.

when you do the original install npm should also create a package_lock.json file which has all the exact versions in. If you copy that over as well as the package.json then the new machine should use that can install those versions... If for some reason it doesn't you can rename that to package.json and then it really should get the exact same one.

2 Likes

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