Getting the monaco editor to work in NR 2.x

Fair point Nick, however I know Andrew backs up his node-red stuff (following previous disasters) :sunglasses:

For anyone else reading & following, ALWAYS backup :slight_smile:

If you started with node-red then simply CTRL-C to stop it.

Nic,

I hear what you are saying, but I am seeing bumps in updating the settings.js file.

I fully appreciate that if I change the httpLocal part it won't propogate to a newly built file if I let node-red do it itself.

But I have NEVER changed the default file name/path and left as much as possible as default.
So: flowFile: 'flows.json', has never been touched.
When I save files they are saved with the name: flows_me-desktop.json for an unknown reason.

To me that is a problem.

So what is the difference between the node-red and node-red-start commands?
(Other than if I do the latter, pressing ^C it does not stop)

ALL

I now have all my old flows back.
Wrong them (but that's ok)
I shall now apply those changes and also the editor stuff.
(Phew. Good news at last.)

If you look at your old settings file you will find it does not have a flowFile setting in it - that is what the old default settings file looked like. That meant the runtime would generate the name of the file to use to include the hostname. This is why you have flows_me-desktop.json.

In a 2.x release we decided it would be better to have a fixed name for the flow file - so we updated the default settings file to include the flowFile setting. That would mean all new installs of Node-RED would get that setting - but existing installs would use their existing settings.js file without the flowFile setting.

Because you have replaced your old settings file with the new one, you now have flowFile set when it wasn't before.

You have two choices:

  1. delete the flowFile setting - so the runtime will go back to generating the filename based on hostname as before
  2. change the flowFile setting to flows_me-desktop.json so you have it hardcoded to the right value.
  • node-red - runs in the terminal. Closing the terminal or pressing CTRL-C ends node-red.
  • node-red-start - runs node-red as a service (background task). Closing the terminal DOES NOT end node-red - instead you need to issue node-red-stop.

From the backed up settings.js file:

module.exports = {

/*******************************************************************************
 * Flow File and User Directory Settings
 *  - flowFile
 *  - credentialSecret
 *  - flowFilePretty
 *  - userDir
 *  - nodesDir
 ******************************************************************************/

    /** The file containing the flows. If not set, defaults to flows_<hostname>.json **/
    flowFile: 'flows.json',

    /** By default, cred

I can't understand the rest - sorry.

If your flows are in a file called flows_me-desktop.json then change the flowFile setting to flows_me-desktop.json

That is all you need to do.

1 Like

Just do one of these 2 ↑

I suggest #2

But I am still stuck with how/why that ever happened/was created.

Given that I didn't change the line in the settings file.
It isn't I am wanting to be argumentative. I just don't understand the history of how the default fine where my flows are saved became flows_me-desktop.json.

So this is what is now in the new settings.js file:
(exert)

/*******************************************************************************
 * Flow File and User Directory Settings
 *  - flowFile
 *  - credentialSecret
 *  - flowFilePretty
 *  - userDir
 *  - nodesDir
 ******************************************************************************/

    /** The file containing the flows. If not set, defaults to flows_<hostname>.json **/
//    flowFile: 'flows.json',
    flowFile: 'flows_me-desktop.json',

Correct?

(Now all I need to do is look back and find how to get the midnight-red theme working.)

        theme: "midnight-red",  // << same as before - set it in settings.
        codeEditor: {
            lib: "monaco", //can be "monaco" or "ace"
            options: {
                // /* theme - must match the file name of a theme in 
                //  * packages/node_modules/@node-red/editor-client/src/vendor/monaco/dist/theme
                //  * e.g. "tomorrow-night", "upstream-sunburst", "github", "my-theme"
                //  */
                theme: "vs-dark",
                wordWrap: true,
                fontSize: 14,
                fontLigatures: true,
                fontFamily: "Cascadia Code, Fira Code, Consolas, 'Courier New', monospace"
            }
        }
1 Like

(How do I mark multiple solutions?) :wink:

Thanks @Steve-Mcl and @knolleary.

In hindsight:
I think I made things bad for myself also recently updating nodes.
I am SURE I had the new editor working.
I remember seeing the "scroll column" on the right of the edit window when editing.
I updated a few nodes and maybe something happened there.

Not sure.
But all good now.

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