Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected token '??=' on manifest.js:286 #2

Closed
rei-vilo opened this issue Oct 16, 2022 · 3 comments
Closed

SyntaxError: Unexpected token '??=' on manifest.js:286 #2

rei-vilo opened this issue Oct 16, 2022 · 3 comments

Comments

@rei-vilo
Copy link

rei-vilo commented Oct 16, 2022

When launching Node-RED, the node-red-mcu-plugin isn't loaded with the following error

$ node-red
16 Oct 10:36:27 - [info] 

Welcome to Node-RED
===================

16 Oct 10:36:27 - [info] Node-RED version: v3.0.2
16 Oct 10:36:27 - [info] Node.js  version: v14.20.1
16 Oct 10:36:27 - [info] Linux 5.10.0-18-amd64 x64 LE
16 Oct 10:36:27 - [info] Loading palette nodes
/home/reivilo/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/lib/manifest.js:286
            mt.build ??= {};
                     ^^^

SyntaxError: Unexpected token '??='
    at wrapSafe (internal/modules/cjs/loader.js:1001:16)
    at Module._compile (internal/modules/cjs/loader.js:1049:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/home/reivilo/.node-red/node_modules/@ralphwetzel/node-red-mcu-plugin/mcu_plugin.js:13:21)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
16 Oct 10:36:28 - [info] Dashboard version 3.2.0 started at /ui
16 Oct 10:36:28 - [info] Settings file  : /home/reivilo/.node-red/settings.js
16 Oct 10:36:28 - [info] Context store  : 'default' [module=memory]
16 Oct 10:36:28 - [info] User directory : /home/reivilo/.node-red
16 Oct 10:36:28 - [info] Projects directory: /home/reivilo/.node-red/projects
16 Oct 10:36:28 - [info] Server now running at http://127.0.0.1:1880/
16 Oct 10:36:28 - [info] Active project : Test_MCU
16 Oct 10:36:28 - [info] Flows file     : /home/reivilo/.node-red/projects/Test_MCU/flow.json
16 Oct 10:36:28 - [warn] Using unencrypted credentials
16 Oct 10:36:28 - [info] Starting flows
16 Oct 10:36:28 - [info] Started flows

Commenting the three lines

// to be sure...
mt.build ??= {};
mt.include ??= [];
mt.modules ??= { "*": [] };

as

            // to be sure...
            // mt.build ??= {};
            // mt.include ??= [];
            // mt.modules ??= { "*": [] };

solves the issue.

@ralphwetzel
Copy link
Owner

Thank you for your report!
It looks like an issue w/ the version of Node.js. Support for the Logical nullish assignment (??=) operator was implemented (only quite recently) with v15.0.0. As Node-RED recommends v14.x LTS this feature is nice yet "too new".
I'll provide a fix.

@ralphwetzel
Copy link
Owner

Should be fixed now by f9025cb.

@ralphwetzel
Copy link
Owner

Confirmed to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants