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

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?

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
        }
    }
}

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

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

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

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.

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

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.

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

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.

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

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.

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