Syntax error in settings.js while using configuration from the official documentation

Hi, does somebody know what could be the reason for this problem? I have not seen anybody else encounter the same thing

for testing im using this settings.js configuration:

adminAuth: {
    type: "credentials",
    users: [
            username: "admin",
            password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
            permissions: "*"
            username: "george",
            password: "$2b$08$wuAqPiKJlVN27eF5qJp.RuQYuy6ZYONW7a/UWYxDTtwKFCdB8F19y",
            permissions: "read"

when i start nodered with node-red-start or i enable the nodered service (ive installed node-red with the suggested script from the documentation) i get this error:

Starting as a systemd service.
Error loading settings file: /home/ubuntu/.node-red/settings.js
    users: [
SyntaxError: Unexpected token ':'
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1055:15)
    at Module._compile (node:internal/modules/cjs/loader:1090:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/lib/node_modules/node-red/red.js:140:20)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
nodered.service: Deactivated successfully.

but when running with command node-red the error does not persist

im using ubuntu server 22lts

Are you sure you've correctly updated the settings file it is trying to use: /home/ubuntu/.node-red/settings.js? That error suggests a missing comma between the previous setting and the users one.

You say it works when you run node-red directly. When you do that, it will log the full path to the settings file it is using. Check it is using the same file.

settings.js:3 suggests you have inserted the section at the start of settings.js rather than inside the exports section. If you search the file for adminAuth you should find a commented out section that you should replace with yours.

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