# Error loading settings file: /home/pi/.node-red/settings.js?

**URL:** <https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874>\
**Category:** General\
**Created:** [8 April 2021 16:05 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874 "2021-04-08T16:05:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [8 April 2021 16:05 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874/1 "2021-04-08T16:05:06Z")

</div>

Error loading settings file: /home/pi/.node-red/settings.js? Ok, I am not seeing why it is not being read.  
This file seems fine to me, what am I missing? If I let NR create the settings file, it works. But if I customize as is below, it fails?

```auto
module.exports = {
    uiPort: process.env.PORT || 1880,
    //uiHost: "127.0.0.1",
    mqttReconnectTime: 15000,
    serialReconnectTime: 15000,
    debugMaxLength: 1000,
    //nodeMessageBufferMaxLength: 0,
    debugUseColors: true,
    flowFile: "flows.json",
    flowFilePretty: true,
    credentialSecret: "Node Red Secret Key D@chshund Digital@1",
    userDir: "/home/pi/.node-red/",
    nodesDir: "/home/pi/.node-red/nodes",
    ui: { path: "ui" },
    functionGlobalContext: {
        os:require("os"),
        i2c:require("i2c-bus"),
        gradient:require("javascript-color-gradient")
    },
    exportGlobalContextKeys: false,
    contextStorage: {
        default: {
            module:"memory"
        },
        persistent: {
                module:"localfilesystem"
        },
    },
    logging: {
        console: {
            level: "info",
            metrics: false,
            audit: false
        }
    },
    editorTheme: {
        projects: {
            enabled: false
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 April 2021 16:09 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874/2 "2021-04-08T16:09:52Z")

</div>

If you go into `~/.node-red` and run the following command, you may get more of a hint:

```auto
node -e 'require("./settings.js")`

```

My guess would be an issue with one of the `require` statements.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [8 April 2021 16:12 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874/3 "2021-04-08T16:12:46Z")

</div>

Thanks! Trying now. Really cool tip as well. if it returns null everything cool or it failed? Assuming not output all good. Did the behavior change? If missing require, error? Reloaded the requires... and seems that was it.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 April 2021 16:14 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874/4 "2021-04-08T16:14:22Z")

</div>

If there's an error you'll know about it. 🙂

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [8 April 2021 16:15 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874/5 "2021-04-08T16:15:30Z")

</div>

Going to have to change my automation scripting that deploys NR. I did not have strict validation of the nodes/modules load per node/module. Just was doing a massive npm install command.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 April 2021 16:20 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874/6 "2021-04-08T16:20:14Z")

</div>

> [@Nodi.Rubrum](#):
>
> Just was doing a massive npm install command.

If everything you need is in package.json then just `npm install` should do it.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [8 April 2021 16:34 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874/7 "2021-04-08T16:34:32Z")

</div>

Right, but I changed the scripting to do some additional error checking on a fresh install. If I am just updating Node or NR, and package.json exists, my scripting uses that method. Of course, I could also just copy the json file as part of the deployment as well. Once in a while a module load fails, regardless of method... so the module by module logging has an advantage, versus parsing the npm logging.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 April 2021 16:39 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874/8 "2021-04-08T16:39:17Z")

</div>

If you run `npm install` I would have expected the return code to indicate success or otherwise, but I haven't verified that.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [8 April 2021 16:42 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874/9 "2021-04-08T16:42:24Z")

</div>

Right, then you have to parse what failed. I find that handling the error within my automation script, retry the module install for example, is easier than parsing the npm logging, and then addressing the issue. Either method would work fine of course. Just comes down to how you want to handle and report issues... as encountered or only after bulk of the install is done.

---

<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:** [22 April 2021 16:42 UTC](https://discourse.nodered.org/t/error-loading-settings-file-home-pi-node-red-settings-js/43874/10 "2021-04-22T16:42:28Z")

</div>

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