# Getting the monaco editor to work in NR 2.x

**URL:** <https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466>\
**Category:** General\
**Created:** [22 July 2022 06:59 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466 "2022-07-22T06:59:59Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 July 2022 08:06 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/21 "2022-07-22T08:06:20Z")

</div>

> [@knolleary](#):
>
> I think recommending a user just deletes their settings file _without_ saying up front they need to restore all the changes they may have made is a recipe for disaster

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

For anyone else reading & following, ALWAYS backup 🙂

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 July 2022 08:08 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/22 "2022-07-22T08:08:14Z")

</div>

> [@Trying\_to\_learn](#):
>
> As I have only done the `node-red` and not `node-red-start`.... I can't it can I.  
> Cos' then node-red will stop.

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 08:08 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/23 "2022-07-22T08:08:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 08:09 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/24 "2022-07-22T08:09:55Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 08:11 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/25 "2022-07-22T08:11:01Z")

</div>

# 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.)

---

<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:** [22 July 2022 08:14 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/26 "2022-07-22T08:14:02Z")

</div>

> [@Trying\_to\_learn](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 July 2022 08:21 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/27 "2022-07-22T08:21:10Z")

</div>

> [@Trying\_to\_learn](#):
>
> So what is the difference between the `node-red` and `node-red-start` commands?

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 08:21 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/28 "2022-07-22T08:21:14Z")

</div>

From the backed up `settings.js` file:

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

---

<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:** [22 July 2022 08:22 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/29 "2022-07-22T08:22:22Z")

</div>

> [@Trying\_to\_learn](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 July 2022 08:22 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/30 "2022-07-22T08:22:26Z")

</div>

> [@knolleary](#):
>
> 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.

Just do one of these 2 ↑

I suggest #2

> [@Steve-Mcl](#):
>
> In your case change `flowFile: 'flows.json',` to `flowFile: 'flows_me-desktop.json',` then restart node-red

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 08:25 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/31 "2022-07-22T08:25:45Z")

</div>

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)

```auto
/ *******************************************************************************
 * 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?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 08:26 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/32 "2022-07-22T08:26:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 July 2022 08:29 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/33 "2022-07-22T08:29:40Z")

</div>

> [@Trying\_to\_learn](#):
>
> Now all I need to do is look back and find how to get the `midnight-red` theme working

```auto
        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"
            }
        }

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 July 2022 08:34 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/34 "2022-07-22T08:34:46Z")

</div>

(How do I mark multiple solutions?) 😉

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.

---

<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:** [5 August 2022 08:34 UTC](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466/35 "2022-08-05T08:34:57Z")

</div>

Closed on 5 August 2022 08:34 UTC

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

[Previous page](https://discourse.nodered.org/t/getting-the-monaco-editor-to-work-in-nr-2-x/65466.md?page=1)
