Update Flow from File System - But what about the Dependencies?

Continuing the discussion from Updating a Node-RED flow from the file system:

The solution proposed in that thread does, indeed, work.

But what if your new "Flow" has some extra dependencies - how would one also get them onto the target machine(s)?

Preferably, via the Dashboard - so that a user can click an 'Update' button ...

See also: https://discourse.nodered.org/t/re-updating-a-node-red-flow-from-the-file-system

Assuming you are doing step 6 "Copy the ".json" file from the temporary folder to "./node-red", the package file will include necessary dependencies. So before launching node-red, execute npm i

Is there a way to do that just from the dashboard?

I've got the Dashboard doing the upload, copy, and restart - but it restarts with:

image

In the log I see "[info] Waiting for missing types to be registered:" and a list of a few modules

As I said...

So before restarting, run npm i inside the .node-red folder.

You already have the actions setup to make the dashboard trigger the copy+restart just modify whatever you do to do copy-npm i-restart

npm -i doesn't seem to have made any difference:

pi@raspberrypi:~/.node-red $ sudo npm i
up to date in 13.079s

1 package is looking for funding
  run `npm fund` for details

pi@raspberrypi:~/.node-red $ node-red-restart
Restarted Node-RED
pi@raspberrypi:~/.node-red $

But then the dashboard still doesn't start:
image

and the log still ends with:

---------------------------------------------------------------------
27 Aug 19:52:27 - [info] Waiting for missing types to be registered:
27 Aug 19:52:27 - [info]  - simpletime
27 Aug 19:52:27 - [info]  - moment
27 Aug 19:52:27 - [info]  - func-exec
27 Aug 19:52:27 - [info]  - bcrypt

dont ever use sudo unless told to do so :slight_smile:

Did you actually copy the package.json file from the working machine to the new one?

no - that wasn't mentioned in the previous thread...

ummmm :point_up:

it just talks about copying the flows.json file?

so it does (i mis-read 6. Copy the ".json" file from the temporary folder to "./node-red". as 6. Copy the ".json" files from the temporary folder to "./node-red".)

OK, then npm i wont make any difference because you do not have the original package.json.

FYI: package.json contains a dependency list of node-red nodes to install. So without that, you would have to manually install missing node.s

1 Like

Hmmm ... the working one doesn't seem to have a package.json file!

It does have package-lock.json - but no package.json !

EDIT

Well, it is there - but the RPi file explorer is just not showing it!

Usually you should copy everything in the .node-red folder except the node_modules folder.

After adding the package.json, the npm i does now attempt some stuff, but fails:

17 silly fetchPackageMetaData error for node-red-contrib-bcrypt@~0.1.3 request to https://registry.npmjs.org/node-red-contrib-bcrypt failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
18 silly fetchPackageMetaData error for node-red-contrib-func-exec@~0.1.11 request to https://registry.npmjs.org/node-red-contrib-func-exec failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
19 silly fetchPackageMetaData error for node-red-contrib-moment@~4.0.0 request to https://registry.npmjs.org/node-red-contrib-moment failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
20 silly fetchPackageMetaData error for node-red-contrib-simpletime@~2.10.0 request to https://registry.npmjs.org/node-red-contrib-simpletime failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
21 silly fetchPackageMetaData error for node-red-contrib-bcrypt@~0.1.3 request to https://registry.npmjs.org/node-red-contrib-bcrypt failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
22 silly fetchPackageMetaData error for node-red-contrib-func-exec@~0.1.11 request to https://registry.npmjs.org/node-red-contrib-func-exec failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
23 silly fetchPackageMetaData error for node-red-contrib-moment@~4.0.0 request to https://registry.npmjs.org/node-red-contrib-moment failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
24 silly fetchPackageMetaData error for node-red-contrib-simpletime@~2.10.0 request to https://registry.npmjs.org/node-red-contrib-simpletime failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

Googling suggests that EAI_AGAIN is likely due to internet access problems - which makes sense here.

So I think that answers the original question, but leaves me to sort out the access.

So what's in the node_modules folder? Would also copying that (potentially) get around the internet access problems?

If your destination machine is identical architecture and OS and has exactly the same nodejs version then probably copying node_modules too would provide a working system. If any of those is different then all bets are off. The npm i command installs and, if necessary, builds all the extra nodes your require so they are compatible with your version of hardware/OS/nodejs version.

2 Likes

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