Dashboard 2.0 Object.hasOwn is not a function

Hi,

I just started with dashboard 2.0 , it works, but there is an error.
What is the reason of this error? I'm trying to understand what causes this

That is odd indeed.

Can you export that flow for others to test please?

Thank for your support,

[
    {
        "id": "25409e71b4d675dc",
        "type": "tab",
        "label": "Error dashboard 2.0",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "14052efb8fd17bcf",
        "type": "ui-gauge",
        "z": "25409e71b4d675dc",
        "name": "test",
        "group": "735425a9791cc343",
        "order": 4,
        "width": "5",
        "height": "3",
        "gtype": "gauge-half",
        "gstyle": "needle",
        "title": "test",
        "units": "",
        "prefix": "",
        "suffix": "",
        "segments": [
            {
                "from": "0",
                "color": "#5cd65c"
            },
            {
                "from": "15",
                "color": "#ffc800"
            },
            {
                "from": "30",
                "color": "#ea5353"
            }
        ],
        "min": 0,
        "max": "100",
        "sizeThickness": 16,
        "sizeGap": 4,
        "sizeKeyThickness": 8,
        "styleRounded": true,
        "styleGlow": false,
        "className": "",
        "x": 770,
        "y": 140,
        "wires": []
    },
    {
        "id": "a3f620b998040cde",
        "type": "inject",
        "z": "25409e71b4d675dc",
        "name": "10",
        "props": [
            {
                "p": "payload.nvalue",
                "v": "10",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 410,
        "y": 120,
        "wires": [
            [
                "87245d7263a0bc79",
                "cb466e5045acfc46"
            ]
        ]
    },
    {
        "id": "87245d7263a0bc79",
        "type": "debug",
        "z": "25409e71b4d675dc",
        "name": "debug 46",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 600,
        "y": 200,
        "wires": []
    },
    {
        "id": "69956835c0969cdc",
        "type": "inject",
        "z": "25409e71b4d675dc",
        "name": "20",
        "props": [
            {
                "p": "payload.nvalue",
                "v": "20",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 410,
        "y": 180,
        "wires": [
            [
                "87245d7263a0bc79",
                "cb466e5045acfc46"
            ]
        ]
    },
    {
        "id": "cb466e5045acfc46",
        "type": "function",
        "z": "25409e71b4d675dc",
        "name": "function 3",
        "func": "// Set msg.payload to msg.payload.nvalue\nmsg.payload = msg.payload.nvalue;\n\n// Return the modified message\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 600,
        "y": 160,
        "wires": [
            [
                "14052efb8fd17bcf",
                "25ec1d5eecc5a922"
            ]
        ]
    },
    {
        "id": "25ec1d5eecc5a922",
        "type": "debug",
        "z": "25409e71b4d675dc",
        "name": "debug 47",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 780,
        "y": 180,
        "wires": []
    },
    {
        "id": "1733ed5d12191dff",
        "type": "inject",
        "z": "25409e71b4d675dc",
        "name": "29",
        "props": [
            {
                "p": "payload.nvalue",
                "v": "29",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 410,
        "y": 240,
        "wires": [
            [
                "cb466e5045acfc46",
                "87245d7263a0bc79"
            ]
        ]
    },
    {
        "id": "735425a9791cc343",
        "type": "ui-group",
        "name": "Testdash",
        "page": "2c8dbd8f4d392b7b",
        "width": "26",
        "height": "14",
        "order": -1,
        "showTitle": true,
        "className": "",
        "visible": "true",
        "disabled": "false"
    },
    {
        "id": "2c8dbd8f4d392b7b",
        "type": "ui-page",
        "name": "Test page",
        "ui": "07d9e68410f8668f",
        "path": "/page1",
        "icon": "home",
        "layout": "grid",
        "theme": "73c61bc8a0120c97",
        "order": -1,
        "className": "",
        "visible": true,
        "disabled": false
    },
    {
        "id": "07d9e68410f8668f",
        "type": "ui-base",
        "name": "UI Name",
        "path": "/dashboard",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control"
        ],
        "showPathInSidebar": false
    },
    {
        "id": "73c61bc8a0120c97",
        "type": "ui-theme",
        "name": "Theme Name",
        "colors": {
            "surface": "#ffffff",
            "primary": "#0094ce",
            "bgPage": "#eeeeee",
            "groupBg": "#ffffff",
            "groupOutline": "#cccccc"
        },
        "sizes": {
            "pagePadding": "12px",
            "groupGap": "12px",
            "groupBorderRadius": "4px",
            "widgetGap": "12px"
        }
    }
]

What version of nodejs are you using? Use node -v to find out. If it is 14.x then it may be another instance of this issue. "TypeError: Object.hasOwn is not a function" Error · Issue #316 · FlowFuse/node-red-dashboard · GitHub

If so then possibly the change there needs to be made in the gauge node too.

I am using, v14.21.3

Ah, that's your problem. Object.hasOwn requires node v16+

Ps, node v14 is out of support as is v16. You should aim for v18lts or v20 lts

Okay, then i need to update. Is there a wiki for an easy update?

There are too many variables (like what OS, what hardware etc). Tell us what you have first.

I believe it should be fixed in the gauge node as dashboard 2 is supposed to work with v14.

I don't remember reading that.

Either way, upgrading node would fix this for the Op and it is definitely recommended as v14 is EOL :man_shrugging:

I have NUC, proxmox, with Debian 11 bullseye.

Then your upgrade is simple, from the docs

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node18

Thanks for your support it worked.

Keep up the good work!

Does that mean that D2 requires Node.js >14 which is still Node-RED's baseline?

Not for long :wink:

In seriousness tho, I playing in the dashboard source & spotted Object.hasOwn is used in the dashboard frontend vue files but they get converted to ES5 through compilation (vite config), the nodes are not & have therefore slipped through the net.

If an issue is raised on dashboard, they will get mopped up. For quick reference, Object.hasOwn appears twice in ui_base.js

Not wanting to push - but any idea of timescales for v4? I've a bunch of outstanding changes for UIBIULDER that I class as potentially breaking but I don't want to add them until the node.js baseline version also changes.

Nick was out last week but AFAIK it pretty much next on the TODO list. (Nick, jump in correct me if I am speaking out of turn)

If I were a betting man, I'd put money on < 1 month for a v4 beta.

1 Like

There already is an issue. TypeError: Object.hasOwn is not a function" Error · Issue #316 · FlowFuse/node-red-dashboard · GitHub

thanks colin.

I've raised a PR: Remove `Object.hasOwn` from node source by Steve-Mcl · Pull Request #590 · FlowFuse/node-red-dashboard · GitHub

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