🎉 Node-RED 2.0 Released

can't seem to get Monaco editor to work. when i add the line it just stops Node-red from starting up.

in the Settings.JS file old one I guess at the bottom I have

// customising the editor
editorTheme: {
    projects: {
        enabled: false
    }
}

so made it then look like

// customising the editor
editorTheme: {
    codeEditor: {
        lib: "monaco"
    }
    projects: {
        enabled: false
    }
}

but it just crashes with

ul 20 22:43:38 DietPi node-red[20976]:     at Module._compile (node:internal/modules/cjs/loader:1072:27)
Jul 20 22:43:38 DietPi node-red[20976]:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
Jul 20 22:43:38 DietPi node-red[20976]:     at Module.load (node:internal/modules/cjs/loader:973:32)
Jul 20 22:43:38 DietPi node-red[20976]:     at Function.Module._load (node:internal/modules/cjs/loader:813:14)
Jul 20 22:43:38 DietPi node-red[20976]:     at Module.require (node:internal/modules/cjs/loader:997:19)
Jul 20 22:43:38 DietPi node-red[20976]:     at require (node:internal/modules/cjs/helpers:92:18)
Jul 20 22:43:38 DietPi node-red[20976]:     at Object.<anonymous> (/usr/local/lib/node_modules/node-red/red.js:136:20)
Jul 20 22:43:38 DietPi node-red[20976]:     at Module._compile (node:internal/modules/cjs/loader:1108:14)
Jul 20 22:43:38 DietPi node-red[20976]:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)

so what did i miss? i also tried adding a , after the } and before projects:

if i completely remove the Projects block then it loads up fine.

You need a comma after the middle curly bracket (what you have is not valid syntax...

    codeEditor: {
        lib: "monaco"
    },
    projects: {
        enabled: false
    }

It's working well for me. all of the i2c libraries/nodes that I use are good. Running on a RaspberryPi4B. I'm on Node-RED 2.0.1 ...

On my PC used for editing, I'm running one of the Windows 11 Beta Previews (anti-climatic.... it's like a Windows98 to Windows98SecondEdition kind of upgrade really).. Anyway... Chrome seems to work fine and I'm able to edit all of my NodeRed flows just the same....

Thanks Steve... oddly i didnt try it with the comma there but must have messed something else in the process. it working now though.

Saw your youtube video @knolleary, love the work!

Please keep it coming.

I love the new update, especially the monaco editor. Great work.

@knolleary However, I am encountering a recurring issue. When trying to open a library in the function after multiple times, the workspace freezes.

For example, I load a function from the library in function node A, all works fine. When I try to load a function from the library in function node B, it freezes up, and I have to reload the browser losing intermediate changes in the process.

Here's a screenshot of the frozen workspace

@knolleary I took a look at this one. The error is occurring here

image

I forget now if remove() was ever a function (should be destroy()) or if I need to handle calls to remove() in the editor code?

The quick and simple fix is to change that line to libraryEditor.destroy();

PS: It was me who wrote that line (my bad)

1 Like

All,

Great work, love the new features.
Question I have though, is this version backwards compatible with V1?
Reason I am asking, I have several projects running on different sites, that have NR V1. I have access to them via a VPN, but I cannot upgrade the Node-Red to V2. I can change the project itself via SSH. So if I make changes in my projects with NR V2 and then copy the project in a machine running NR V1, will this break? I make the assumption that it will not break, as all is based on NodeJS and NR is the programming/GUI interface, but assumptions make you look like .... well, you know. :slight_smile:

the main breaking change was dropping support for nodejs 8 and 10 which are out of support anyway - so going forwards there may well be code that starts to use features in node12 and 14 that aren't available in node8 and 10 and will thus not work. If you are already using Node12 or better in your deployments then you should be OK - but as with all things it is down to you to test and verify that.

1 Like

I don't see any references to .remove() in 1.3.5 - it must have been something you added. I'll make the change unless you have a PR on the way?

As long as the flows you create only use features of nodes that are also available in 1.x, then you should be fine copying the flow json from 2.x to 1.x.

1 Like

So, to be clear in my mind, as long as the nodes I am using where there in V1 and where not especially made for V2, all will be well. So any new updates of nodes can be a potential problem, for example SQLite or Modbus, if they go through a revision change I need to contact the provider, to ensure they are compatible. Standard included nodes of NR are compatible?

When creating node-RED system backup routines, is it necessary (or even desirable) to include .config.modules.json in the backup list?
(I want to keep my node-RED Backup Flow - #22 by Paul-Reed project up to date)

It is the only record of what extra modules the runtime has installed for you. At some point in the future, if we have a UI to help manage those modules, then it will use that list to limit what it lets you remove.

So it is probably worth backing up, although not essential.

1 Like

Encountered a issue. I'm using the monaco editor, and every time i try to use JSONata editor or the JSON editor, it wont let me type stuff.

How to reproduce:

  1. Open up an inject or change node.
  2. Change output to either JSONata or JSON
  3. Open up the full editor and try to write something.

@get_joe using what browser?

Chrome, ver. 92.0.4515.107. I don't see any errors in the logs btw.

I found out that this issue only exist on one of my two Node-RED instances. I'm not able to write in function nodes either. @knolleary

Thanks for looking into it Steve.

Did you look in chrome console?

F12 → console