I recently booted a computer with TrueNAS. I transfer the Node-Red configuration present on Synology NAS to it. On TrueNAS, Node-RED runs as a Docker container. The following are available externally: "flows.json flows_cred.json lib node_modules package-lock.json package.json settings.js"
I need to add as "functionGlobalContext" to add my function: cheap-electricity-tariff - npm
Unfortunately, TrueNAS blocks the installation of additional features not in the container, so I can't use npm install...
I added the appropriate entry to the settings.js file and copied the directories created after installing my library on my computer to the node_modules directory on the TrueNAS server and added the appropriate entry in package.json.
Unfortunately, the container does not start showing the error: "Error loading settings file: /data/settings.js" After removing "isCheapTarriff:require('cheap-electricity-tariff')," from the "functionGlobalContext" section, Node-Red runs but the function is of course not available
if that is the only external module you are adding then you probably don't want the comma at the end of the line
It does not matter.
I deleted the package-lock.json file. I have installed some library in Node-Red. Then, based on package.json, a new package-lock.json was built with my library added. The error is gone and the container starts but the program does not see my function:
"TypeError: Cannot read properties of undefined (reading 'isCheapTariff')"