# Node-Red on TrueNAS Scale and functionGlobalContext

**URL:** <https://discourse.nodered.org/t/node-red-on-truenas-scale-and-functionglobalcontext/80351>\
**Category:** General\
**Tags:** docker\
**Created:** [6 August 2023 13:40 UTC](https://discourse.nodered.org/t/node-red-on-truenas-scale-and-functionglobalcontext/80351 "2023-08-06T13:40:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wachcio](https://avatars.discourse-cdn.com/v4/letter/w/a87d85/32.png) [@wachcio](https://discourse.nodered.org/u/wachcio)\
**Post date:** [6 August 2023 13:40 UTC](https://discourse.nodered.org/t/node-red-on-truenas-scale-and-functionglobalcontext/80351/1 "2023-08-06T13:40:05Z")

</div>

Hello  
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](https://www.npmjs.com/package/cheap-electricity-tariff?activeTab=readme)  
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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [6 August 2023 15:27 UTC](https://discourse.nodered.org/t/node-red-on-truenas-scale-and-functionglobalcontext/80351/2 "2023-08-06T15:27:08Z")

</div>

if that is the only external module you are adding then you probably don't want the comma at the end of the line

---

<div class="post-metadata">

**Author:** ![wachcio](https://avatars.discourse-cdn.com/v4/letter/w/a87d85/32.png) [@wachcio](https://discourse.nodered.org/u/wachcio)\
**Post date:** [6 August 2023 16:50 UTC](https://discourse.nodered.org/t/node-red-on-truenas-scale-and-functionglobalcontext/80351/3 "2023-08-06T16:50:03Z")

</div>

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')"

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 October 2023 16:50 UTC](https://discourse.nodered.org/t/node-red-on-truenas-scale-and-functionglobalcontext/80351/4 "2023-10-05T16:50:44Z")

</div>

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