# Newbie question - load initial flow and also in UI too

**URL:** <https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243>\
**Category:** General\
**Created:** [9 December 2020 12:56 UTC](https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243 "2020-12-09T12:56:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![karlyboy](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@karlyboy](https://discourse.nodered.org/u/karlyboy)\
**Post date:** [9 December 2020 12:56 UTC](https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243/1 "2020-12-09T12:56:37Z")

</div>

Ref Karlos and Nick O'leary from his youtube post (told me post it here). I'm a newby plz plz be gentle 🙂 I have my linux file system with nodejs v15 running. Node-red starts, visualizer runs and i can open up json files, deploy and run and all works fine. I've tried so many things.

My file system is structured this way  
userDir:"/data/app/home/nol/.nodered",  
nodesDir:"/data/app/.nodered/nodes",  
core.json is deployed in the test userDir and nodesDir at this moment.

The problem is the core.json which is flowFile never starts on the server, so when i do myserver/red/api/ping it comes back as error in the page, when i manually load the core.json (import) and deploy the ping works.

So the default script isn't starting and I've hunted for reasons why. Also the script isn't loaded in the UI either

So my quesitons are:-

1. How do i get the core.json (in settings config) to load by default (as server starts)
2. How do i get the UI to autoload the default script or what approach do i need to take to achieve this

Any pointer or references I am so grateful (banging my head here). I am new generally to this, and if I've done something silly, please do not shout hehe 🙂

Thanks to everyone here

Karlos

## The settings config is in the nodejs script

```auto
var settings = {
  httpAdminRoot:"/red",
  httpNodeRoot: "/api",
  userDir:"/data/app/home/nol/.nodered/",
  nodesDir:"/data/app/.nodered/nodes",
  flowFile:"core.json",
  logging:{ console: {
        level: "trace",
        metrics: false,
        audit: false
    }
  },
  functionGlobalContext: { }, // enables global context
  editorTheme: {
      header: {
          title: "Node RED",
          image: "/data/app/files/images/custom.gif", // or null to remove image
          url: "myurl" // optional url to make the header text/image a link to this url
      },
      projects: {
         enabled: false
      },
      page: {
          title: "Node RED visualizer",
          scripts: ["/data/app/.nodered/core.json"]
      }
  }
};

```

## The NodeJS is

```auto
  RED.init(server,settings);

  // Serve the editor UI from /red
  app.use(settings.httpAdminRoot,RED.httpAdmin);
  app.use(settings.httpNodeRoot,RED.httpNode);
 RED.start().then((result) => {
    console.log("Event : Node Red has started successfully");
});

```

---

<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:** [9 December 2020 13:04 UTC](https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243/2 "2020-12-09T13:04:01Z")

</div>

Is there a reason you are using your own node.js code to run Node-RED, rather than run it directly using the `node-red` command?

When Node-RED starts up it logs the full path to the flows files it is using. Given the configuration you have, what does it log?

```auto
userDir:"/data/app/home/nol/.nodered/",
  nodesDir:"/data/app/.nodered/nodes",

```

Why are you using `/home/nol/` in the path? That appears in the default settings file as an example path (its actually the home directory on my laptop - `nol` is my username).

---

<div class="post-metadata">

**Author:** ![karlyboy](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@karlyboy](https://discourse.nodered.org/u/karlyboy)\
**Post date:** [9 December 2020 13:27 UTC](https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243/3 "2020-12-09T13:27:21Z")

</div>

I've integrated into the nodejs script which i read was an option, I was considering running it from the command line with a separate settings file but yet to do that.

as for the home/no1, i was simply replicating an example i saw but this will change later, but paths physically exist on the server.

also even with Node-red integrated in the nodejs script this is the log output

Dec 00:37:35 - [info] Loading palette nodes  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-contrib-actionflows 2.0.3  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-contrib-actionflows  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-contrib-browser-utils 0.0.9  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-contrib-browser-utils  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-contrib-file-buffer 0.0.3  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-contrib-file-buffer  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-contrib-image-output 0.6.3  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-contrib-image-output  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-contrib-mic 0.0.1  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-contrib-mic  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-contrib-pdf 0.1.0  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-contrib-pdf  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-contrib-play-audio 2.5.0  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-contrib-play-audio  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-contrib-socketio 1.0.7  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-contrib-socketio  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-contrib-zip 1.0.0  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-contrib-zip  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-dashboard 2.24.2  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-dashboard  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-node-alexa 1.0.13  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-node-alexa  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-node-aws 0.1.8  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-node-aws  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-node-google 0.2.2  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-node-google  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-node-rbe 0.2.9  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-node-rbe  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-node-tail 0.1.1  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-node-tail  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-node-ui-table 0.3.10  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-node-ui-table  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] Module: node-red-node-watson 0.9.2  
2020-12-05 00:37:35 b92cec5d61eb 5 Dec 00:37:35 - [debug] /data/app/node\_modules/node-red-node-watson  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [warn] [RED.events] Deprecated use of "nodes-started" event from "/data/app/node\_modules/node-red-contrib-actionflows/actionflows/actionflows.js:615:14". Use "flows:started" instead.  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [info] Dashboard version 2.24.2 started at /api/ui  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [trace] utils.writeFile - copied /data/app/home/nol/.nodered/.config.nodes.json TO /data/app/home/nol/.nodered/.config.nodes.json.backup  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [trace] utils.writeFile - written content to /data/app/home/nol/.nodered/.config.nodes.json.$$$  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [trace] utils.writeFile - renamed /data/app/home/nol/.nodered/.config.nodes.json.$$$ to /data/app/home/nol/.nodered/.config.nodes.json  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [info] Context store : 'default' [module=memory]  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [info] User directory : /data/app/home/nol/.nodered  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [warn] Projects disabled : editorTheme.projects.enabled=false  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [info] Flows file : /data/app/home/nol/.nodered/core.json  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [info] Creating new flow file  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [debug] loaded flow revision: d751713988987e9331980363e24189ce  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [debug] red/runtime/nodes/credentials.load : no user key present  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [debug] red/runtime/nodes/credentials.load : no default key present - generating one  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [debug] red/runtime/nodes/credentials.load : keyType=system  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [warn]

2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [trace] utils.writeFile - copied /data/app/home/nol/.nodered/.config.runtime.json TO /data/app/home/nol/.nodered/.config.runtime.json.backup  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [trace] utils.writeFile - written content to /data/app/home/nol/.nodered/.config.runtime.json.$$$  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [trace] utils.writeFile - renamed /data/app/home/nol/.nodered/.config.runtime.json.$$$ to /data/app/home/nol/.nodered/.config.runtime.json  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [trace] runtime event: {"id":"runtime-state","retain":true}  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [trace] runtime event: {"id":"runtime-deploy","payload":{"revision":"d751713988987e9331980363e24189ce"},"retain":true}  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [info] Starting flows  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [debug] red/nodes/flows.start : starting flow : global  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [trace] [flow:global] start flow [global]  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [trace] runtime event: {"id":"runtime-state","retain":true}  
2020-12-05 00:37:36 b92cec5d61eb 5 Dec 00:37:36 - [info] Started flows

---

<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:** [9 December 2020 13:45 UTC](https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243/4 "2020-12-09T13:45:28Z")

</div>

The log output contains this:

```auto
[info] Flows file : /data/app/home/nol/.nodered/core.json
[info] Creating new flow file

```

This tells you exactly what path it is using for the flow file - and that it has not found an existing file there, so is creating a new file.

So `/data/app/home/nol/.nodered/core.json` does not exist. If you copy your flow file to that exact location, then Node-RED will load it.

---

<div class="post-metadata">

**Author:** ![karlyboy](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@karlyboy](https://discourse.nodered.org/u/karlyboy)\
**Post date:** [9 December 2020 14:00 UTC](https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243/5 "2020-12-09T14:00:01Z")

</div>

Maybe i'm missing something but that's exactly what I have, virtually the path starts at /data/app. The image is what i see in FTP.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fe33eb0d30b0bf618ef32078c93c37118f5dabcc.png) ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fe33eb0d30b0bf618ef32078c93c37118f5dabcc.png)

---

<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:** [9 December 2020 14:17 UTC](https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243/6 "2020-12-09T14:17:39Z")

</div>

You have created a directory called `no1` but the configuration uses `nol`.

---

<div class="post-metadata">

**Author:** ![karlyboy](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@karlyboy](https://discourse.nodered.org/u/karlyboy)\
**Post date:** [9 December 2020 14:36 UTC](https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243/7 "2020-12-09T14:36:49Z")

</div>

ahhhhhhhhh well spotted, let me retry, cannot tell the characters apart, so would never have spotted that.

Right Mister, I am in your debt! I need a new pair of glasses in my 40's, and its all working. So I want to thank you kindly for taking pity on a newby, the scripts load and run and the UI loads up the script.

What an amazing platform, and a real credit to the work you and everyone else has put in.

I will watch more of your tutorials and updates. Again thank you so so much! I can now cross this off my to-do list!

Thank you kindly

Karlos

---

<div class="post-metadata">

**Author:** ![karlyboy](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@karlyboy](https://discourse.nodered.org/u/karlyboy)\
**Post date:** [10 December 2020 14:02 UTC](https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243/8 "2020-12-10T14:02:06Z")

</div>

There are certain co-exist conditions on small scale services that allow for the data to potentially be shared between the two. I assume running this in its own nodejs start up process gives more bandwidth resources? What I might do is create a separate settings js file and try running the node-red as a separate option. I'm happy to follow your advice on any pros cons. I've changed the directory structure now as i was just following basic example of a settings example that was posted. I've changed that now.

Cheers

---

<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:** [8 February 2021 14:02 UTC](https://discourse.nodered.org/t/newbie-question-load-initial-flow-and-also-in-ui-too/37243/9 "2021-02-08T14:02:08Z")

</div>

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