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

**URL:** <https://discourse.nodered.org/t/syntax-error-in-settings-js-while-using-configuration-from-the-official-documentation/66655>\
**Category:** General\
**Created:** [19 August 2022 09:16 UTC](https://discourse.nodered.org/t/syntax-error-in-settings-js-while-using-configuration-from-the-official-documentation/66655 "2022-08-19T09:16:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcom-UR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcom-ur/32/66492_2.png) [@Marcom-UR](https://discourse.nodered.org/u/Marcom-UR)\
**Post date:** [19 August 2022 09:16 UTC](https://discourse.nodered.org/t/syntax-error-in-settings-js-while-using-configuration-from-the-official-documentation/66655/1 "2022-08-19T09:16:44Z")

</div>

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:

```auto
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:

```auto
Starting as a systemd service.
Error loading settings file: /home/ubuntu/.node-red/settings.js
/home/ubuntu/.node-red/settings.js:3
    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

---

<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:** [19 August 2022 09:21 UTC](https://discourse.nodered.org/t/syntax-error-in-settings-js-while-using-configuration-from-the-official-documentation/66655/2 "2022-08-19T09:21:21Z")

</div>

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.

---

<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:** [19 August 2022 09:37 UTC](https://discourse.nodered.org/t/syntax-error-in-settings-js-while-using-configuration-from-the-official-documentation/66655/3 "2022-08-19T09:37:27Z")

</div>

> [@Marcom-UR](#):
>
> ```auto
> Error loading settings file: /home/ubuntu/.node-red/settings.js
> /home/ubuntu/.node-red/settings.js:3
> users: [
> 
> ```

`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.

---

<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:** [18 October 2022 09:38 UTC](https://discourse.nodered.org/t/syntax-error-in-settings-js-while-using-configuration-from-the-official-documentation/66655/4 "2022-10-18T09:38:23Z")

</div>

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